Merge branch 'master' of github.com:Mineplex-LLC/Minecraft-PC into feature/game-variants
# Conflicts: # Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java
This commit is contained in:
commit
0fb84e57c1
@ -0,0 +1,52 @@
|
||||
package mineplex.core.common.animation;
|
||||
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class AnimationPoint
|
||||
{
|
||||
|
||||
private final int _tick;
|
||||
private final Vector _move;
|
||||
private final Vector _dir;
|
||||
|
||||
public AnimationPoint(int tick, Vector move, Vector dir)
|
||||
{
|
||||
_tick = tick;
|
||||
_move = move.clone();
|
||||
_dir = dir.clone();
|
||||
}
|
||||
|
||||
public Vector getMove()
|
||||
{
|
||||
return _move.clone();
|
||||
}
|
||||
|
||||
public Vector getDirection()
|
||||
{
|
||||
return _dir.clone();
|
||||
}
|
||||
|
||||
public int getTick()
|
||||
{
|
||||
return _tick;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if(obj instanceof AnimationPoint) {
|
||||
AnimationPoint point = (AnimationPoint) obj;
|
||||
return point._tick == _tick && point._move.equals(_move);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return Objects.hash(_tick, _move);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,161 @@
|
||||
package mineplex.core.common.animation;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.PriorityQueue;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
/**
|
||||
* Self sufficient animator to animate task with steps using local vector logic
|
||||
*/
|
||||
|
||||
public abstract class Animator
|
||||
{
|
||||
private final Plugin _plugin;
|
||||
|
||||
// private TreeSet<AnimationPoint> _points = new TreeSet<>((a, b) -> Integer.compare(a.getTick(), b.getTick()));
|
||||
private Set<AnimationPoint> _points = new HashSet<>();
|
||||
private PriorityQueue<AnimationPoint> _queue = new PriorityQueue<>((a, b) -> Integer.compare(a.getTick(), b.getTick()));
|
||||
|
||||
private AnimationPoint _prev;
|
||||
private AnimationPoint _next;
|
||||
private Location _baseLoc;
|
||||
private int _tick = -1;
|
||||
|
||||
private boolean _repeat = false;
|
||||
|
||||
private BukkitTask _task;
|
||||
|
||||
public Animator(Plugin plugin)
|
||||
{
|
||||
_plugin = plugin;
|
||||
}
|
||||
|
||||
public void addPoint(AnimationPoint point) {
|
||||
_points.add(point);
|
||||
}
|
||||
|
||||
public void removePoint(AnimationPoint point) {
|
||||
_points.remove(point);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns a cloned list of the animator points for this instance.
|
||||
*/
|
||||
public Set<AnimationPoint> getSet() {
|
||||
return new HashSet<AnimationPoint>(_points);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the actual list of animator points used by this instance. As this is not a copy, editing this list will apply
|
||||
* changes to the current instance.
|
||||
*/
|
||||
public Set<AnimationPoint> getSetRaw() {
|
||||
return _points;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the animation at the given location. If the animator is already running then this call will be silently ignored.
|
||||
* @param loc Location the animation will start relative too. The vector poitns will be added to relative to this location.
|
||||
*/
|
||||
public void start(Location loc)
|
||||
{
|
||||
if(isRunning()) return;
|
||||
|
||||
_queue.clear();
|
||||
_queue.addAll(_points);
|
||||
|
||||
if(_queue.isEmpty()) return;
|
||||
|
||||
_baseLoc = loc.clone();
|
||||
_next = _queue.peek();
|
||||
_prev = new AnimationPoint(0, _next.getMove().clone(), _next.getDirection().clone());
|
||||
|
||||
_task = new BukkitRunnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
_tick++;
|
||||
|
||||
if(_next.getTick() < _tick)
|
||||
{
|
||||
_queue.remove();
|
||||
_prev = _next;
|
||||
_next = _queue.peek();
|
||||
}
|
||||
|
||||
if(_queue.isEmpty())
|
||||
{
|
||||
if(_repeat)
|
||||
{
|
||||
Location clone = _baseLoc.clone();
|
||||
stop();
|
||||
start(clone);
|
||||
}
|
||||
else
|
||||
{
|
||||
finish(_baseLoc);
|
||||
stop();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Location prev = _baseLoc.clone().add(_prev.getMove());
|
||||
Location next = _baseLoc.clone().add(_next.getMove());
|
||||
prev.setDirection(_prev.getDirection());
|
||||
|
||||
double diff = ((double)_tick-_prev.getTick())/(_next.getTick()-_prev.getTick());
|
||||
prev.add(next.clone().subtract(prev).toVector().multiply(diff));
|
||||
|
||||
Vector dirDiff = _next.getDirection().subtract(prev.getDirection());
|
||||
dirDiff.multiply(diff);
|
||||
prev.setDirection(prev.getDirection().add(dirDiff));
|
||||
|
||||
tick(prev);
|
||||
}
|
||||
}.runTaskTimer(_plugin, 0, 1);
|
||||
}
|
||||
|
||||
public boolean isRunning()
|
||||
{
|
||||
return _task != null;
|
||||
}
|
||||
|
||||
public void stop()
|
||||
{
|
||||
if(!isRunning()) return;
|
||||
_task.cancel();
|
||||
_task = null;
|
||||
_tick = -1;
|
||||
_baseLoc = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns true if the animation should repeat.
|
||||
* @see #setRepeat(boolean)
|
||||
*/
|
||||
public boolean isRepeat()
|
||||
{
|
||||
return _repeat;
|
||||
}
|
||||
|
||||
/**
|
||||
* If the last animation point does not make the animation end up at the exact same location as the start
|
||||
* then it might lead to unexpected results as it will re-start the animation from the end of the animation.
|
||||
*/
|
||||
public void setRepeat(boolean repeat)
|
||||
{
|
||||
_repeat = repeat;
|
||||
}
|
||||
|
||||
protected abstract void tick(Location loc);
|
||||
|
||||
|
||||
protected abstract void finish(Location loc);
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package mineplex.core.common.animation;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
/**
|
||||
* An implementation of the {@link Animator} which will teleport the provided entity along the animation path each tick.
|
||||
*/
|
||||
|
||||
public class AnimatorEntity extends Animator
|
||||
{
|
||||
|
||||
private final Entity _ent;
|
||||
|
||||
public AnimatorEntity(Plugin plugin, Entity ent)
|
||||
{
|
||||
super(plugin);
|
||||
_ent = ent;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tick(Location loc)
|
||||
{
|
||||
if(!_ent.isValid())
|
||||
{
|
||||
stop();
|
||||
return;
|
||||
}
|
||||
_ent.setVelocity(new Vector(0,0,0));
|
||||
_ent.teleport(loc);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finish(Location loc) {}
|
||||
|
||||
}
|
@ -0,0 +1,126 @@
|
||||
package mineplex.core.common.block;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftChunk;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.BlockVector;
|
||||
|
||||
import mineplex.core.common.util.MapUtil;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import net.minecraft.server.v1_8_R3.Chunk;
|
||||
import net.minecraft.server.v1_8_R3.ChunkCoordIntPair;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutMultiBlockChange;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutMultiBlockChange.MultiBlockChangeInfo;
|
||||
|
||||
/**
|
||||
* An agent used to easily record and send multi-block update packets to players. The agent handles if the packet should be a
|
||||
* MultiBlock packet or a chunk update. It also supports blocks across multiple chunks.
|
||||
*/
|
||||
|
||||
public class MultiBlockUpdaterAgent
|
||||
{
|
||||
|
||||
private Map<Chunk, List<BlockVector>> _chunks = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Add a block to the list of blocks to send to the player. The agent supports blocks across different chunks and
|
||||
* will not send duplicates.
|
||||
* @param block The block to send. The block is stored using a BlockVector, meaning that when the send method is called, it will use
|
||||
* the material and data found for the block at the moment you call the send method.
|
||||
* @see #send(Collection)
|
||||
*/
|
||||
public void addBlock(Block block)
|
||||
{
|
||||
Chunk c = ((CraftChunk)block.getChunk()).getHandle();
|
||||
List<BlockVector> list = _chunks.computeIfAbsent(c,chunk -> new ArrayList<>());
|
||||
|
||||
if(list.size() >= 64) return;
|
||||
|
||||
BlockVector bv = block.getLocation().toVector().toBlockVector();
|
||||
if(list.contains(bv)) return;
|
||||
list.add(bv);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends all the record blocks to all online players. Players out of range will not receive packets.
|
||||
* @see #send(Collection)
|
||||
*/
|
||||
public void send()
|
||||
{
|
||||
send(UtilServer.getPlayersCollection());
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all blocks for this agent.
|
||||
*/
|
||||
public void reset()
|
||||
{
|
||||
_chunks.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Send all the recorded blocks to the provided players. This will only send packets to players in range. If the blocks span multiple
|
||||
* chunks then players will only receive block updates for chunks close to them.
|
||||
* @param players The players which will the packets will be sent to.
|
||||
*/
|
||||
public void send(Collection<? extends Player> players)
|
||||
{
|
||||
for(Player p : players)
|
||||
{
|
||||
for(Chunk c : _chunks.keySet())
|
||||
{
|
||||
if(!p.getWorld().equals(c.bukkitChunk.getWorld())) continue;
|
||||
|
||||
int x = p.getLocation().getChunk().getX();
|
||||
int z = p.getLocation().getChunk().getZ();
|
||||
|
||||
int chunkDist = Math.max(Math.abs(c.locX-x), Math.abs(c.locZ-z));
|
||||
|
||||
if(chunkDist > Bukkit.getViewDistance()) continue;
|
||||
|
||||
sendPacket(c, players);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void sendPacket(Chunk c, Collection<? extends Player> players)
|
||||
{
|
||||
List<BlockVector> list = _chunks.get(c);
|
||||
|
||||
if(list == null) return;
|
||||
|
||||
if(list.size() >= 64)
|
||||
{
|
||||
for(Player p : players)
|
||||
{
|
||||
MapUtil.SendChunkForPlayer(c, p);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PacketPlayOutMultiBlockChange packet = new PacketPlayOutMultiBlockChange();
|
||||
packet.a = new ChunkCoordIntPair(c.locX, c.locZ);
|
||||
packet.b = new MultiBlockChangeInfo[list.size()];
|
||||
for(int i = 0; i < list.size(); i++)
|
||||
{
|
||||
BlockVector bv = list.get(i);
|
||||
short xyz = (short)((bv.getBlockX() & 0xF) << 12 | (bv.getBlockZ() & 0xF) << 8 | bv.getBlockY());
|
||||
packet.b[i] = packet.new MultiBlockChangeInfo(xyz, c);
|
||||
}
|
||||
|
||||
for(Player p : players)
|
||||
{
|
||||
UtilPlayer.sendPacket(p, packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -3,6 +3,9 @@ package mineplex.core.common.block.schematic;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.mysql.jdbc.Util;
|
||||
|
||||
import mineplex.core.common.block.DataLocationMap;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
@ -14,24 +17,47 @@ public class Schematic
|
||||
private final short _length;
|
||||
private final short[] _blocks;
|
||||
private final byte[] _blockData;
|
||||
private final Vector _weOffset;
|
||||
|
||||
public Schematic(short width, short height, short length, short[] blocks, byte[] blockData)
|
||||
public Schematic(short width, short height, short length, short[] blocks, byte[] blockData, Vector worldEditOffset)
|
||||
{
|
||||
_width = width;
|
||||
_height = height;
|
||||
_length = length;
|
||||
_blocks = blocks;
|
||||
_blockData = blockData;
|
||||
_weOffset = worldEditOffset;
|
||||
}
|
||||
|
||||
public Schematic(short width, short height, short length, short[] blocks, byte[] blockData)
|
||||
{
|
||||
this(width, height, length, blocks, blockData, null);
|
||||
}
|
||||
|
||||
public DataLocationMap paste(Location originLocation)
|
||||
{
|
||||
return paste(originLocation, false);
|
||||
}
|
||||
|
||||
public DataLocationMap paste(Location originLocation, boolean ignoreAir)
|
||||
{
|
||||
return paste(originLocation, ignoreAir, false);
|
||||
}
|
||||
|
||||
public DataLocationMap paste(Location originLocation, boolean ignoreAir, boolean worldEditOffset)
|
||||
{
|
||||
if(worldEditOffset && hasWorldEditOffset())
|
||||
{
|
||||
originLocation = originLocation.clone().add(_weOffset);
|
||||
}
|
||||
DataLocationMap locationMap = new DataLocationMap();
|
||||
|
||||
int startX = originLocation.getBlockX();
|
||||
int startY = originLocation.getBlockY();
|
||||
int startZ = originLocation.getBlockZ();
|
||||
|
||||
UtilBlock.startQuickRecording();
|
||||
|
||||
for (int x = 0; x < _width; x++)
|
||||
{
|
||||
for (int y = 0; y < _height; y++)
|
||||
@ -87,6 +113,8 @@ public class Schematic
|
||||
}
|
||||
}
|
||||
|
||||
UtilBlock.stopQuickRecording();
|
||||
|
||||
return locationMap;
|
||||
}
|
||||
|
||||
@ -142,6 +170,11 @@ public class Schematic
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasWorldEditOffset()
|
||||
{
|
||||
return _weOffset != null;
|
||||
}
|
||||
|
||||
public int getSize()
|
||||
{
|
||||
return _blocks.length;
|
||||
|
@ -6,8 +6,11 @@ import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.java.sk89q.jnbt.ByteArrayTag;
|
||||
import com.java.sk89q.jnbt.CompoundTag;
|
||||
import com.java.sk89q.jnbt.IntTag;
|
||||
import com.java.sk89q.jnbt.NBTInputStream;
|
||||
import com.java.sk89q.jnbt.NamedTag;
|
||||
import com.java.sk89q.jnbt.ShortTag;
|
||||
@ -37,6 +40,15 @@ public class UtilSchematic
|
||||
short[] blocks = new short[blockId.length];
|
||||
byte[] blockData = getChildTag(schematic, "Data", ByteArrayTag.class).getValue();
|
||||
|
||||
Vector weOffset = null;
|
||||
if(schematic.containsKey("WEOffsetX") && schematic.containsKey("WEOffsetY") && schematic.containsKey("WEOffsetZ"))
|
||||
{
|
||||
int x = getChildTag(schematic, "WEOffsetX", IntTag.class).getValue();
|
||||
int y = getChildTag(schematic, "WEOffsetY", IntTag.class).getValue();
|
||||
int z = getChildTag(schematic, "WEOffsetZ", IntTag.class).getValue();
|
||||
weOffset = new Vector(x, y, z);
|
||||
}
|
||||
|
||||
if (schematic.containsKey("AddBlocks"))
|
||||
{
|
||||
addId = getChildTag(schematic, "AddBlocks", ByteArrayTag.class).getValue();
|
||||
@ -56,7 +68,7 @@ public class UtilSchematic
|
||||
}
|
||||
|
||||
|
||||
return new Schematic(width, height, length, blocks, blockData);
|
||||
return new Schematic(width, height, length, blocks, blockData, weOffset);
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,16 @@
|
||||
package mineplex.core.common.shape;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
||||
/**
|
||||
* Interface used by classes which can display visuals at provided locations.
|
||||
*/
|
||||
public interface CosmeticShape
|
||||
{
|
||||
/**
|
||||
* Display a visual at the given location
|
||||
* @param loc The location to display the visual at
|
||||
*/
|
||||
void display(Location loc);
|
||||
|
||||
}
|
@ -0,0 +1,189 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* A simple 3D vector stored shape
|
||||
*/
|
||||
|
||||
public class Shape
|
||||
{
|
||||
|
||||
protected final static double DEFAULT_DENSITY = 1;
|
||||
|
||||
protected HashSet<Vector> _points = new HashSet<>();
|
||||
|
||||
public Shape(){}
|
||||
|
||||
public Shape(Collection<Vector> points){
|
||||
this._points.addAll(points);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotate this shape along the X-axis
|
||||
* @param radians Radians to rotate the shape
|
||||
*/
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotate this shape along the Y-axis
|
||||
* @param radians Radians to rotate the shape
|
||||
*/
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotate this shape along the Z-axis
|
||||
* @param radians Radians to rotate the shape
|
||||
*/
|
||||
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<>(_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<>();
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the closest length which will be a factor of the provided length, but not longer then max
|
||||
* E.g. You want to split a length of 9 into even peaces, but the peaces should not be longer than the max 5, then this will
|
||||
* return 4.5, as 4.5 goes 2 times to make up precisely 9.
|
||||
* @param length The length which the returned factor should fit into
|
||||
* @param max The max distance of the returned length
|
||||
* @return The closest to length to be a factor of the provided length which is <= max
|
||||
*/
|
||||
|
||||
public static double getRoundFactor(double length, double max)
|
||||
{
|
||||
return length/Math.ceil(length/max);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the closest RoundFactor length applied to a vector, using the vector as the max length. The returned vector is a cloned
|
||||
* parallel vector to the provided length
|
||||
* @param length The vector used as length and direction
|
||||
* @param maxLength The max length of the new returned vector
|
||||
* @return Returns a parallel vector to the given length vector which is also a factor of the provided vector, but not longer
|
||||
* then maxLength
|
||||
*
|
||||
* @see #getRoundFactor(double, double)
|
||||
*/
|
||||
public static Vector getVectorFactor(Vector length, double maxLength)
|
||||
{
|
||||
return length.clone().multiply(getRoundFactor(length.length(), maxLength));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
package mineplex.core.common.shape;
|
||||
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
/**
|
||||
* An extension of {@link Shape} creating a simple box
|
||||
*/
|
||||
|
||||
public class ShapeBox extends Shape
|
||||
{
|
||||
|
||||
/**
|
||||
* Define a parallelepiped using three vectors using default density {@link Shape#DefaultDensity} and is not hollow
|
||||
* @param localx The first vector to use as local x direction, does not have to align to global x direction
|
||||
* @param localy The second vector to use as local y direction, does not have to align to global y direction
|
||||
* @param localz The third vector to use as local z direction, does not have to align to global z direction
|
||||
*/
|
||||
|
||||
public ShapeBox(Vector localx, Vector localy, Vector localz)
|
||||
{
|
||||
this(localx, localy, localz, false, DEFAULT_DENSITY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Define a parallelepiped using three vectors using default density {@link Shape#DefaultDensity}
|
||||
* @param localx The first vector to use as local x direction, does not have to align to global x direction
|
||||
* @param localy The second vector to use as local y direction, does not have to align to global y direction
|
||||
* @param localz The third vector to use as local z direction, does not have to align to global z direction
|
||||
* @param hollow If the parallelepiped box should be hollow or not
|
||||
*/
|
||||
|
||||
public ShapeBox(Vector localx, Vector localy, Vector localz, boolean hollow)
|
||||
{
|
||||
this(localx, localy, localz, hollow, DEFAULT_DENSITY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Define a parallelepiped using three vectors
|
||||
* @param localx The first vector to use as local x direction, does not have to align to global x direction
|
||||
* @param localy The second vector to use as local y direction, does not have to align to global y direction
|
||||
* @param localz The third vector to use as local z direction, does not have to align to global z direction
|
||||
* @param hollow If the parallelepiped box should be hollow or not
|
||||
* @param density The density of the vector points
|
||||
*/
|
||||
public ShapeBox(Vector localx, Vector localy, Vector localz, boolean hollow, double density)
|
||||
{
|
||||
Vector x = Shape.getVectorFactor(localx, density);
|
||||
Vector y = Shape.getVectorFactor(localx, density);
|
||||
Vector z = Shape.getVectorFactor(localx, density);
|
||||
|
||||
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-1 || iy == 0 || iy == ym-1 || iz == 0 || iz == zm-1)) continue;
|
||||
}
|
||||
_points.add(x.clone().multiply(ix).add(y.clone().multiply(iy)).add(z.clone().multiply(iz)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package mineplex.core.common.shape;
|
||||
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
/**
|
||||
* A simple grid shape which uses string inputs to define points
|
||||
*/
|
||||
|
||||
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(DEFAULT_DENSITY, '#', 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, where the first line is on the top of the shape.
|
||||
* Use the <code>read</code> char for each point and anything else for each "non-point".
|
||||
* The finished shape will then be centered afterwards.
|
||||
*/
|
||||
public ShapeGrid(char read, String...input)
|
||||
{
|
||||
this(DEFAULT_DENSITY, read, 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 the <code>read</code> char for each point and anything else for each "non-point".
|
||||
* The finished shape will then be centered afterwards.
|
||||
*/
|
||||
public ShapeGrid(double density, char read, String...input)
|
||||
{
|
||||
int lx = 0;
|
||||
int ly = 0;
|
||||
int lz = 0;
|
||||
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) == read) addPoint(new Vector(-x,-y+input.length,-z).multiply(density));
|
||||
if(x > lx) lx = x;
|
||||
if(-y+input.length > ly) ly = -y+input.length;
|
||||
if(z > lz) lz= z;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add(new Vector(-lx,ly,-lz).multiply(-0.5*density));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package mineplex.core.common.shape;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
/**
|
||||
* A bag collection of several shapes. This will add all the points from the given shapes into a new shape
|
||||
*/
|
||||
|
||||
public class ShapeMulti extends Shape
|
||||
{
|
||||
|
||||
/**
|
||||
* @param shapes Shapes which points will be added to this instance of a shape
|
||||
*/
|
||||
public ShapeMulti(Collection<Shape> shapes)
|
||||
{
|
||||
for(Shape shape : shapes) addShape(shape);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param shapes Shapes which points will be added to this instance of a shape
|
||||
*/
|
||||
public ShapeMulti(Shape... shapes)
|
||||
{
|
||||
for(Shape shape : shapes) addShape(shape);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add all the points from the given shape to this shape
|
||||
* @param shape
|
||||
*/
|
||||
public void addShape(Shape shape) {
|
||||
for(Vector v : shape._points) add(v);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package mineplex.core.common.shape;
|
||||
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
/**
|
||||
* A simple sphere defined using vector points extending {@link Shape}
|
||||
*/
|
||||
|
||||
public class ShapeSphere extends Shape
|
||||
{
|
||||
|
||||
/**
|
||||
* Define a sphere with radius r that is not hollow and using default density {@link Shape#DefaultDensity}
|
||||
* @param r Radius for the sphere
|
||||
*/
|
||||
public ShapeSphere(double r)
|
||||
{
|
||||
this(r,r,r);
|
||||
}
|
||||
|
||||
/**
|
||||
* A sphere with different radiuses on different planes that is not hollow and using default density {@link Shape#DefaultDensity}
|
||||
* @param x Radius in x direction
|
||||
* @param y Radius in y direction
|
||||
* @param z Radius in z direction
|
||||
*/
|
||||
public ShapeSphere(double x, double y, double z)
|
||||
{
|
||||
this(x, y, z, false, DEFAULT_DENSITY);
|
||||
}
|
||||
|
||||
/**
|
||||
* A sphere with different radiuses on different planes using default density {@link Shape#DefaultDensity}
|
||||
* @param x Radius in x direction
|
||||
* @param y Radius in y direction
|
||||
* @param z Radius in z direction
|
||||
* @param hollow If the sphere should be hollow or not
|
||||
*/
|
||||
public ShapeSphere(double x, double y, double z, boolean hollow)
|
||||
{
|
||||
this(x, y, z, hollow, DEFAULT_DENSITY);
|
||||
}
|
||||
|
||||
/**
|
||||
* A sphere with different radiuses on different planes
|
||||
* @param x Radius in x direction
|
||||
* @param y Radius in y direction
|
||||
* @param z Radius in z direction
|
||||
* @param hollow If the sphere should be hollow or not
|
||||
* @param density Density between points
|
||||
*/
|
||||
public ShapeSphere(double x, double y, double z, boolean hollow, double density)
|
||||
{
|
||||
for(double px = -x; px <= x; x += Shape.getRoundFactor(2*x, density))
|
||||
{
|
||||
for(double py = -y; py <= y; y += Shape.getRoundFactor(2*y, density))
|
||||
{
|
||||
for(double pz = -z; pz <= z; z += Shape.getRoundFactor(2*z, density))
|
||||
{
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,173 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* Some simple wing shapes implementing {@link ICosmeticShape} storing additional particle information
|
||||
*/
|
||||
|
||||
public class ShapeWings extends ShapeGrid implements CosmeticShape
|
||||
{
|
||||
public static final String[] ANGEL_WING_PATTERN = new String[]
|
||||
{
|
||||
"000$$0000000000$$000",
|
||||
"00$##$00000000$##$00",
|
||||
"0$####$000000$####$0",
|
||||
"$#####$000000$#####$",
|
||||
"$#####$000000$#####$",
|
||||
"$######$0000$######$",
|
||||
"$######$0000$######$",
|
||||
"$######$0000$######$",
|
||||
"$######$$$$$$######$",
|
||||
"$##################$",
|
||||
"0$################$0",
|
||||
"00$####$$$$$$####$00",
|
||||
"00$####$0000$####$00",
|
||||
"000$##$000000$##$000",
|
||||
"000$##$000000$##$000",
|
||||
"000$#$00000000$#$000",
|
||||
"00$#$0000000000$#$00",
|
||||
"00$#$0000000000$#$00",
|
||||
"000$000000000000$000",
|
||||
};
|
||||
|
||||
public static final String[] BUTTERFLY_WING_PATTERN = new String[]
|
||||
{
|
||||
"0$$0000000000000000$$0",
|
||||
"$##$00000000000000$##$",
|
||||
"0$##$000000000000$##$0",
|
||||
"00$##$0000000000$##$00",
|
||||
"00$###$00000000$###$00",
|
||||
"000$####$0000$####$000",
|
||||
"000$######$$#####$0000",
|
||||
"0000$############$0000",
|
||||
"00000$##########$00000",
|
||||
"00000$##########$00000",
|
||||
"00000$####$$$###$00000",
|
||||
"00000$###$000$###$0000",
|
||||
"00000$##$00000$##$0000",
|
||||
"000000$000000000$00000"
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Default rotation to give the wings a little tilt when displayed on players for instance
|
||||
*/
|
||||
public static double DEFAULT_ROTATION = Math.PI/0.05;
|
||||
|
||||
|
||||
private String _particle;
|
||||
private Vector _offsetData;
|
||||
private float _speed;
|
||||
private int _count;
|
||||
|
||||
/**
|
||||
* A simple non-edge wing shape using the default butterfly pattern {@link ShapeWings#BUTTERFLY_WING_PATTERN}
|
||||
* and x-rotation {@link #DEFAULT_ROTATION}. It also uses default redstone dust particle with offset of 0, speed of 0 and count 1
|
||||
*/
|
||||
public ShapeWings()
|
||||
{
|
||||
this(ParticleType.RED_DUST.particleName);
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple non-edge wing shape using the default butterfly pattern {@link ShapeWings#BUTTERFLY_WING_PATTERN}
|
||||
* and x-rotation {@link #DEFAULT_ROTATION}
|
||||
* @param particle The particle to display at each point in the wing shape. Using offset of 0, speed of 0 and count 1
|
||||
*/
|
||||
public ShapeWings(String particle)
|
||||
{
|
||||
this(particle, null, 0, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple non-edge wing shape using the default butterfly pattern {@link ShapeWings#BUTTERFLY_WING_PATTERN}
|
||||
* and x-rotation {@link #DEFAULT_ROTATION}
|
||||
* @param particle The particle to display at each point in the wing shape
|
||||
* @param offsetData Particle data
|
||||
* @param speed Particle speed
|
||||
* @param count Particle count
|
||||
*/
|
||||
public ShapeWings(String particle, Vector offsetData, float speed, int count)
|
||||
{
|
||||
this(particle, offsetData, speed, count, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple wing shape using the default butterfly pattern {@link ShapeWings#BUTTERFLY_WING_PATTERN}
|
||||
* and x-rotation {@link #DEFAULT_ROTATION}
|
||||
* @param particle The particle to display at each point in the wing shape
|
||||
* @param offsetData Particle data
|
||||
* @param speed Particle speed
|
||||
* @param count Particle count
|
||||
* @param edge If this is the edge of the wings or not
|
||||
*/
|
||||
public ShapeWings(String particle, Vector offsetData, float speed, int count, boolean edge)
|
||||
{
|
||||
this(particle, offsetData, speed, count, edge, DEFAULT_ROTATION);
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple wing shape using the default butterfly pattern {@link ShapeWings#BUTTERFLY_WING_PATTERN}
|
||||
* @param particle The particle to display at each point in the wing shape
|
||||
* @param offsetData Particle data
|
||||
* @param speed Particle speed
|
||||
* @param count Particle count
|
||||
* @param edge If this is the edge of the wings or not
|
||||
* @param xRotation Rotation on the x axis
|
||||
*/
|
||||
public ShapeWings(String particle, Vector offsetData, float speed, int count, boolean edge, double xRotation)
|
||||
{
|
||||
this(particle, offsetData, speed, count, edge, xRotation, BUTTERFLY_WING_PATTERN);
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple wing shape
|
||||
* @param particle The particle to display at each point in the wing shape
|
||||
* @param offsetData Particle data
|
||||
* @param speed Particle speed
|
||||
* @param count Particle count
|
||||
* @param edge If this is the edge of the wings or not
|
||||
* @param xRotation Rotation on the x axis
|
||||
* @param pattern Pattern to use as wing shape
|
||||
*/
|
||||
public ShapeWings(String particle, Vector offsetData, float speed, int count, boolean edge, double xRotation, String... pattern)
|
||||
{
|
||||
super(0.15, edge? '$' : '#',
|
||||
pattern
|
||||
);
|
||||
|
||||
_particle = particle;
|
||||
_offsetData = offsetData;
|
||||
_speed = speed;
|
||||
_count = count;
|
||||
|
||||
rotateOnXAxis(xRotation);
|
||||
}
|
||||
|
||||
@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);
|
||||
displayParticle(ploc);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a single particle of the type provided to this shape at the given location.
|
||||
*/
|
||||
public void displayParticle(Location loc)
|
||||
{
|
||||
UtilParticle.PlayParticleToAll(_particle, loc, _offsetData, _speed, _count, ViewDist.NORMAL);
|
||||
}
|
||||
|
||||
}
|
@ -3,7 +3,6 @@ package mineplex.core.common.util;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Queue;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -28,9 +27,9 @@ import org.bukkit.inventory.meta.BannerMeta;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
import org.bukkit.material.Bed;
|
||||
|
||||
import mineplex.core.common.block.MultiBlockUpdaterAgent;
|
||||
import net.minecraft.server.v1_8_R3.BlockPosition;
|
||||
import net.minecraft.server.v1_8_R3.Blocks;
|
||||
import net.minecraft.server.v1_8_R3.EnumDirection;
|
||||
import net.minecraft.server.v1_8_R3.IBlockData;
|
||||
import net.minecraft.server.v1_8_R3.Item;
|
||||
import net.minecraft.server.v1_8_R3.MathHelper;
|
||||
@ -92,6 +91,8 @@ public class UtilBlock
|
||||
*/
|
||||
public static HashSet<BlockFace> horizontals = new HashSet<>();
|
||||
|
||||
private static MultiBlockUpdaterAgent _quickChangeRecorder;
|
||||
|
||||
static
|
||||
{
|
||||
|
||||
@ -604,14 +605,52 @@ public class UtilBlock
|
||||
return getInBoundingBox(a, b, true);
|
||||
}
|
||||
|
||||
public static ArrayList<Block> getInBoundingBox(Location a, Location b, boolean ignoreAir)
|
||||
public static ArrayList<Block> getInBoundingBox(Location a, Location b, boolean ignoreAir) {
|
||||
return getInBoundingBox(a, b, ignoreAir, false, true, true);
|
||||
}
|
||||
|
||||
public static ArrayList<Block> getInBoundingBox(Location a, Location b, boolean ignoreAir, boolean hollow, boolean walls, boolean ceilfloor)
|
||||
{
|
||||
ArrayList<Block> blocks = new ArrayList<Block>();
|
||||
|
||||
for (int x = Math.min(a.getBlockX(), b.getBlockX()); x <= Math.max(a.getBlockX(), b.getBlockX()); x++)
|
||||
for (int y = Math.min(a.getBlockY(), b.getBlockY()); y <= Math.max(a.getBlockY(), b.getBlockY()); y++)
|
||||
for (int z = Math.min(a.getBlockZ(), b.getBlockZ()); z <= Math.max(a.getBlockZ(), b.getBlockZ()); z++)
|
||||
int xmin = Math.min(a.getBlockX(), b.getBlockX());
|
||||
int xmax = Math.max(a.getBlockX(), b.getBlockX());
|
||||
|
||||
int ymin = Math.min(a.getBlockY(), b.getBlockY());
|
||||
int ymax = Math.max(a.getBlockY(), b.getBlockY());
|
||||
|
||||
int zmin = Math.min(a.getBlockZ(), b.getBlockZ());
|
||||
int zmax = Math.max(a.getBlockZ(), b.getBlockZ());
|
||||
|
||||
for (int x = xmin; x <= xmax; x++)
|
||||
for (int y = ymin; y <= ymax; y++)
|
||||
for (int z = zmin; z <= zmax; z++)
|
||||
{
|
||||
|
||||
if(hollow)
|
||||
{
|
||||
if(!(x == xmin || x == xmax || y == ymin || y == ymax || z == zmin || z == zmax)) continue;
|
||||
}
|
||||
|
||||
if(!walls)
|
||||
{
|
||||
if(
|
||||
(x == xmin || x == xmax) ||
|
||||
(z == zmin || z == zmax)
|
||||
)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if(!ceilfloor)
|
||||
{
|
||||
if(y == ymin || y == ymax)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
Block block = a.getWorld().getBlockAt(x, y, z);
|
||||
|
||||
if (ignoreAir)
|
||||
@ -619,7 +658,9 @@ public class UtilBlock
|
||||
if (block.getType() != Material.AIR) blocks.add(block);
|
||||
}
|
||||
else
|
||||
{
|
||||
blocks.add(block);
|
||||
}
|
||||
}
|
||||
|
||||
return blocks;
|
||||
@ -1466,6 +1507,39 @@ public class UtilBlock
|
||||
return state.update(false, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* See {@link #setQuick(World, int, int, int, int, byte)}
|
||||
*/
|
||||
public static void startQuickRecording()
|
||||
{
|
||||
if(_quickChangeRecorder != null)
|
||||
{
|
||||
_quickChangeRecorder.send();
|
||||
_quickChangeRecorder.reset();
|
||||
}
|
||||
else
|
||||
{
|
||||
_quickChangeRecorder = new MultiBlockUpdaterAgent();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* See {@link #setQuick(World, int, int, int, int, byte)}
|
||||
*/
|
||||
public static void stopQuickRecording()
|
||||
{
|
||||
if(_quickChangeRecorder == null) return;
|
||||
_quickChangeRecorder.send();
|
||||
_quickChangeRecorder.reset();
|
||||
_quickChangeRecorder = null;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This doesn't send the block changes to the client. If you want to change lots of blocks and then send it to the player
|
||||
* then do <code>startQuickRecording()</code> first. Change all the blocks you want. Then to send it do
|
||||
* <code>stopQuickRecording()</code>. This will automatically send all the block changes to all relevant players.
|
||||
*/
|
||||
public static void setQuick(World world, int x, int y, int z, int type, byte data)
|
||||
{
|
||||
int cx = x >> 4;
|
||||
@ -1479,6 +1553,11 @@ public class UtilBlock
|
||||
BlockPosition pos = new BlockPosition(x, y, z);
|
||||
IBlockData ibd = net.minecraft.server.v1_8_R3.Block.getById(type).fromLegacyData(data);
|
||||
chunk.a(pos, ibd);
|
||||
|
||||
if(_quickChangeRecorder != null)
|
||||
{
|
||||
_quickChangeRecorder.addBlock(world.getBlockAt(x, y, z));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1504,4 +1583,35 @@ public class UtilBlock
|
||||
{
|
||||
return boundless(origin.getLocation(), radius);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the max distance this blocks bounding box extends in the given block face. E.g. stone have a max:min of 1:0 in all direction.
|
||||
* Slabs have 0:1 in horizontal directions, but 0:0.5 or 0.5:1 depending on if it is top or bottom.
|
||||
* @param block The block to test
|
||||
* @param blockFace The direction to test in
|
||||
* @return
|
||||
*/
|
||||
public static double getSize(Block block, BlockFace blockFace)
|
||||
{
|
||||
BlockPosition bpos = new BlockPosition(block.getX(), block.getY(), block.getZ());
|
||||
net.minecraft.server.v1_8_R3.Block b = ((CraftWorld)block.getWorld()).getHandle().c(bpos);
|
||||
|
||||
switch (blockFace)
|
||||
{
|
||||
default:
|
||||
case WEST:
|
||||
return b.B(); //min-x
|
||||
case EAST:
|
||||
return b.C(); //max-x
|
||||
case DOWN:
|
||||
return b.D(); //min-y
|
||||
case UP:
|
||||
return b.E(); //max-y
|
||||
case NORTH:
|
||||
return b.F(); //min-z
|
||||
case SOUTH:
|
||||
return b.G(); //max-z
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,13 @@
|
||||
package mineplex.core.common.util;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Created by Shaun on 11/12/2014.
|
||||
@ -13,6 +20,8 @@ public class UtilColor
|
||||
public static final RGBData RgbLightRed = hexToRgb(0xeb1c1c);
|
||||
public static final RGBData RgbPurple = hexToRgb(0x9c17a3);
|
||||
|
||||
public static final Color DEFAULT_LEATHER_COLOR = Color.fromRGB(160, 101, 64);
|
||||
|
||||
public static byte chatColorToClayData(ChatColor chatColor)
|
||||
{
|
||||
//TODO
|
||||
@ -72,6 +81,52 @@ public class UtilColor
|
||||
}
|
||||
}
|
||||
|
||||
public static ChatColor woolDataToChatColor(byte data)
|
||||
{
|
||||
switch (data)
|
||||
{
|
||||
case 0:
|
||||
return ChatColor.WHITE;
|
||||
case 1:
|
||||
return ChatColor.GOLD;
|
||||
case 2:
|
||||
return ChatColor.DARK_PURPLE;
|
||||
case 3:
|
||||
return ChatColor.BLUE;
|
||||
case 4:
|
||||
return ChatColor.YELLOW;
|
||||
case 5:
|
||||
return ChatColor.GREEN;
|
||||
case 6:
|
||||
return ChatColor.LIGHT_PURPLE;
|
||||
case 7:
|
||||
return ChatColor.DARK_GRAY;
|
||||
case 8:
|
||||
return ChatColor.GRAY;
|
||||
case 9:
|
||||
return ChatColor.DARK_AQUA;
|
||||
case 10:
|
||||
return ChatColor.DARK_PURPLE;
|
||||
case 11:
|
||||
return ChatColor.DARK_BLUE;
|
||||
case 12:
|
||||
return ChatColor.DARK_RED;
|
||||
case 13:
|
||||
return ChatColor.DARK_GREEN;
|
||||
case 14:
|
||||
return ChatColor.RED;
|
||||
case 15:
|
||||
return ChatColor.BLACK;
|
||||
default:
|
||||
return ChatColor.WHITE;
|
||||
}
|
||||
}
|
||||
|
||||
public static Vector colorToVector(Color color)
|
||||
{
|
||||
return new Vector(Math.max(color.getRed()/255.0, 0.00001f), color.getGreen()/255.0, color.getBlue()/255.0);
|
||||
}
|
||||
|
||||
public static RGBData hexToRgb(int hex)
|
||||
{
|
||||
return new RGBData(hex >> 16, hex >> 8 & 0xFF, hex & 0xFF);
|
||||
@ -91,4 +146,73 @@ public class UtilColor
|
||||
{
|
||||
return new RGBData(r, g, b);
|
||||
}
|
||||
|
||||
public static Color getNextColor(Color original, Color finalColor, int increment)
|
||||
{
|
||||
int red = original.getRed(), green = original.getGreen(), blue = original.getBlue();
|
||||
|
||||
if (red > finalColor.getRed())
|
||||
red -= increment;
|
||||
else if (red < finalColor.getRed())
|
||||
red += increment;
|
||||
else if (green > finalColor.getGreen())
|
||||
green -= increment;
|
||||
else if (green < finalColor.getGreen())
|
||||
green += increment;
|
||||
else if (blue > finalColor.getBlue())
|
||||
blue -= increment;
|
||||
else if (blue < finalColor.getBlue())
|
||||
blue += increment;
|
||||
|
||||
red = UtilMath.clamp(red, 0, 255);
|
||||
green = UtilMath.clamp(green, 0, 255);
|
||||
blue = UtilMath.clamp(blue, 0, 255);
|
||||
|
||||
return Color.fromRGB(red, green, blue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies Color to a Leather armor
|
||||
* @param itemStack
|
||||
* @param color
|
||||
* @return ItemStack with color applied
|
||||
*/
|
||||
public static ItemStack applyColor(@Nonnull ItemStack itemStack, Color color)
|
||||
{
|
||||
switch (itemStack.getType())
|
||||
{
|
||||
case LEATHER_HELMET:
|
||||
case LEATHER_CHESTPLATE:
|
||||
case LEATHER_LEGGINGS:
|
||||
case LEATHER_BOOTS:
|
||||
LeatherArmorMeta leatherArmorMeta = (LeatherArmorMeta) itemStack.getItemMeta();
|
||||
|
||||
leatherArmorMeta.setColor(color);
|
||||
itemStack.setItemMeta(leatherArmorMeta);
|
||||
return itemStack;
|
||||
default:
|
||||
return itemStack;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets color from Leather armor
|
||||
* @param itemStack
|
||||
* @return Color of the item
|
||||
*/
|
||||
public static Color getItemColor(@Nonnull ItemStack itemStack)
|
||||
{
|
||||
switch (itemStack.getType())
|
||||
{
|
||||
case LEATHER_HELMET:
|
||||
case LEATHER_CHESTPLATE:
|
||||
case LEATHER_LEGGINGS:
|
||||
case LEATHER_BOOTS:
|
||||
LeatherArmorMeta leatherArmorMeta = (LeatherArmorMeta) itemStack.getItemMeta();
|
||||
|
||||
return leatherArmorMeta.getColor();
|
||||
default:
|
||||
return DEFAULT_LEATHER_COLOR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -258,6 +258,21 @@ public class UtilEnt
|
||||
}
|
||||
}
|
||||
|
||||
public static void addGoalSelector(Entity entity, int priority, PathfinderGoal goal)
|
||||
{
|
||||
try
|
||||
{
|
||||
if(((CraftEntity)entity).getHandle() instanceof EntityInsentient)
|
||||
{
|
||||
((EntityInsentient)((CraftEntity)entity).getHandle()).goalSelector.a(priority, goal);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void Rotate(LivingEntity entity, float yaw, float pitch)
|
||||
{
|
||||
EntityLiving handle = ((CraftLivingEntity) entity).getHandle();
|
||||
@ -857,6 +872,11 @@ public class UtilEnt
|
||||
return ent.getLocation().getBlock().getTypeId() == 8 || ent.getLocation().getBlock().getTypeId() == 9;
|
||||
}
|
||||
|
||||
public static void setBoundingBox(Entity ent, double width, double height)
|
||||
{
|
||||
((CraftEntity)ent).getHandle().setSize((float) width, (float)height);
|
||||
}
|
||||
|
||||
public static void SetMetadata(Entity entity, String key, Object value)
|
||||
{
|
||||
entity.setMetadata(key, new FixedMetadataValue(UtilServer.getPlugin(), value));
|
||||
@ -879,4 +899,40 @@ public class UtilEnt
|
||||
equipment.setItemInHand(item);
|
||||
}
|
||||
|
||||
public static byte getEntityEggData(EntityType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case CREEPER: return (byte) 50;
|
||||
case SKELETON: return (byte) 51;
|
||||
case SPIDER: return (byte) 52;
|
||||
case ZOMBIE: return (byte) 54;
|
||||
case SLIME: return (byte) 55;
|
||||
case GHAST: return (byte) 56;
|
||||
case PIG_ZOMBIE: return (byte) 57;
|
||||
case ENDERMAN: return (byte) 58;
|
||||
case CAVE_SPIDER: return (byte) 59;
|
||||
case SILVERFISH: return (byte) 60;
|
||||
case BLAZE: return (byte) 61;
|
||||
case MAGMA_CUBE: return (byte) 62;
|
||||
case BAT: return (byte) 65;
|
||||
case WITCH: return (byte) 66;
|
||||
case ENDERMITE: return (byte) 67;
|
||||
case GUARDIAN: return (byte) 68;
|
||||
//case SHULKER: return (byte) 69;
|
||||
case PIG: return (byte) 90;
|
||||
case SHEEP: return (byte) 91;
|
||||
case COW: return (byte) 92;
|
||||
case CHICKEN: return (byte) 93;
|
||||
case SQUID: return (byte) 94;
|
||||
case WOLF: return (byte) 95;
|
||||
case MUSHROOM_COW: return (byte) 96;
|
||||
case OCELOT: return (byte) 98;
|
||||
case HORSE: return (byte) 100;
|
||||
case RABBIT: return (byte) 101;
|
||||
case VILLAGER: return (byte) 120;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -193,6 +193,13 @@ public class UtilGear
|
||||
return item.getType() == mat;
|
||||
}
|
||||
|
||||
public static boolean isMatAndData(ItemStack item, Material mat, byte data)
|
||||
{
|
||||
if (item == null) return false;
|
||||
|
||||
return item.getType() == mat && item.getData().getData() == data;
|
||||
}
|
||||
|
||||
public static boolean isRepairable(ItemStack item)
|
||||
{
|
||||
return (item.getType().getMaxDurability() > 0);
|
||||
|
@ -9,13 +9,21 @@ 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.block.Block;
|
||||
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 org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
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
|
||||
{
|
||||
@ -1148,6 +1156,66 @@ public class UtilItem
|
||||
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);
|
||||
}
|
||||
|
||||
ent.setTicksLived(32768);
|
||||
|
||||
UtilEnt.SetMetadata(ent, "UtilItemSpawning", true);
|
||||
|
||||
if(ticksToLive != -1)
|
||||
{
|
||||
Plugin plugin = Bukkit.getPluginManager().getPlugin("Hub");
|
||||
if(plugin == null) plugin = Bukkit.getPluginManager().getPlugin("Arcade");
|
||||
if(plugin == null) plugin = Bukkit.getPluginManager().getPlugins()[0];
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
ent.remove();
|
||||
}
|
||||
}.runTaskLater(plugin, 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;
|
||||
}
|
||||
|
||||
public static double getAttackDamage(Material type)
|
||||
{
|
||||
return ItemDamage.get(type);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package mineplex.core.common.util;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@ -10,6 +11,7 @@ import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.*;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
@ -29,9 +31,6 @@ import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.MinecraftVersion;
|
||||
import mineplex.core.common.events.PlayerMessageEvent;
|
||||
import net.minecraft.server.v1_8_R3.EntityPlayer;
|
||||
import net.minecraft.server.v1_8_R3.Packet;
|
||||
import net.minecraft.server.v1_8_R3.PlayerConnection;
|
||||
|
||||
public class UtilPlayer
|
||||
{
|
||||
@ -40,6 +39,9 @@ public class UtilPlayer
|
||||
// A mapping of player names (Keys) to the system time when they last changed active Hotbar Slot
|
||||
private static Map<String, Long> _hotbarUpdates = new HashMap<String, Long>();
|
||||
|
||||
// A mapping of player names (Keys) to the world border they are using (if they are using)
|
||||
private static final Map<UUID, WorldBorder> _worldBorders = new HashMap<UUID, WorldBorder>();
|
||||
|
||||
// The amount of time (in milliseconds) after changin hotbars that you can block
|
||||
public static final long BLOCKING_HOTBAR_DELAY = 100;
|
||||
|
||||
@ -69,6 +71,38 @@ public class UtilPlayer
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void hideFrom(Player player, Collection<Player> players) {
|
||||
players.stream().forEach(p->p.hidePlayer(player));
|
||||
}
|
||||
|
||||
public static void showFor(Player player, Collection<Player> players) {
|
||||
players.stream().forEach(p->p.hidePlayer(player));
|
||||
}
|
||||
|
||||
public static void hideFromAll(Player player, Collection<Player> except) {
|
||||
UtilServer.getPlayersCollection().stream().filter(p->!except.contains(p)).forEach(p->p.hidePlayer(player));
|
||||
}
|
||||
|
||||
public static void showForAll(Player player, Collection<Player> except) {
|
||||
UtilServer.getPlayersCollection().stream().filter(p->!except.contains(p)).forEach(p->p.showPlayer(player));
|
||||
}
|
||||
|
||||
public static void hideFrom(Player player, Player...players) {
|
||||
hideFrom(player, Arrays.asList(players));
|
||||
}
|
||||
|
||||
public static void showFor(Player player, Player...players) {
|
||||
showFor(player, Arrays.asList(players));
|
||||
}
|
||||
|
||||
public static void hideFromAll(Player player, Player...players) {
|
||||
hideFromAll(player, Arrays.asList(players));
|
||||
}
|
||||
|
||||
public static void showForAll(Player player, Player...players) {
|
||||
showForAll(player, Arrays.asList(players));
|
||||
}
|
||||
|
||||
public static boolean is1_9(Player player)
|
||||
{
|
||||
return ((CraftPlayer) player).getHandle().playerConnection.networkManager.getVersion() > 47;
|
||||
@ -823,6 +857,45 @@ public class UtilPlayer
|
||||
((CraftPlayer) player).getHandle().setWingsDeployAt(distance);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the world border red screen for a player
|
||||
* @param player
|
||||
* @param warningDistance
|
||||
*/
|
||||
public static void sendRedScreen(Player player, int warningDistance)
|
||||
{
|
||||
WorldBorder worldBorder = _worldBorders.computeIfAbsent(player.getUniqueId(), uuid -> new WorldBorder());
|
||||
worldBorder.setCenter(player.getLocation().getX(), player.getLocation().getZ());
|
||||
worldBorder.setSize(10000);
|
||||
worldBorder.setWarningDistance(warningDistance);
|
||||
PacketPlayOutWorldBorder packet = new PacketPlayOutWorldBorder(worldBorder, PacketPlayOutWorldBorder.EnumWorldBorderAction.INITIALIZE);
|
||||
sendPacket(player, packet);
|
||||
_worldBorders.put(player.getUniqueId(), worldBorder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if player has a WorldBorder object stored
|
||||
* @param player
|
||||
* @return true if WorldBorder object is stored for that player
|
||||
*/
|
||||
public static boolean hasWorldBorder(Player player)
|
||||
{
|
||||
return _worldBorders.containsKey(player.getUniqueId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes player from world border map
|
||||
* @param player
|
||||
*/
|
||||
public static void removeWorldBorder(Player player)
|
||||
{
|
||||
if (hasWorldBorder(player))
|
||||
{
|
||||
sendRedScreen(player, 0);
|
||||
_worldBorders.remove(player.getUniqueId());
|
||||
}
|
||||
}
|
||||
|
||||
public static MinecraftVersion getVersion(Player player)
|
||||
{
|
||||
if (is1_9(player))
|
||||
|
@ -6,7 +6,6 @@ import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
@ -17,8 +16,10 @@ import mineplex.core.common.CurrencyType;
|
||||
|
||||
public class UtilText
|
||||
{
|
||||
private static HashMap<Character, Integer> _characters = new HashMap<Character, Integer>();
|
||||
private static HashMap<Character, BufferedImage> _characterImages = new HashMap<Character, BufferedImage>();
|
||||
private static HashMap<Character, Integer> _characters = new HashMap<>();
|
||||
private static HashMap<Character, BufferedImage> _characterImages = new HashMap<>();
|
||||
|
||||
private final static char[] VOWELS = new char[]{'a', 'e', 'i', 'o', 'u'};
|
||||
|
||||
static
|
||||
{
|
||||
@ -286,12 +287,7 @@ public class UtilText
|
||||
|
||||
public static String[] splitLineToArray(String string, LineFormat lineFormat)
|
||||
{
|
||||
ArrayList<String> lineList = splitLine(string, lineFormat);
|
||||
|
||||
String[] lineArray = new String[lineList.size()];
|
||||
lineArray = lineList.toArray(lineArray);
|
||||
|
||||
return lineArray;
|
||||
return splitLinesToArray(string.split("\n"), lineFormat);
|
||||
}
|
||||
|
||||
public static ArrayList<String> splitLine(String string, LineFormat lineFormat)
|
||||
@ -308,7 +304,7 @@ public class UtilText
|
||||
// Empty
|
||||
if (string.equals("") || string.equals(" "))
|
||||
{
|
||||
strings.add(string);
|
||||
strings.add(" ");
|
||||
return strings;
|
||||
}
|
||||
|
||||
@ -624,7 +620,20 @@ public class UtilText
|
||||
|
||||
public static boolean plural(int x)
|
||||
{
|
||||
return x <= 0 ? true : x > 1;
|
||||
return x != 1;
|
||||
}
|
||||
|
||||
public static String plural(String word, int amount)
|
||||
{
|
||||
if(!plural(amount)) return word;
|
||||
String sufix = "s";
|
||||
if(word.endsWith("s") || word.endsWith("x") || word.endsWith("z") || word.endsWith("ch")) sufix = "es";
|
||||
else if(word.endsWith("y"))
|
||||
{
|
||||
word.substring(0, word.length()-2);
|
||||
sufix = "ies";
|
||||
}
|
||||
return word + sufix;
|
||||
}
|
||||
|
||||
public static String trim(int maxLength, String s)
|
||||
@ -698,4 +707,43 @@ public class UtilText
|
||||
|
||||
return possesiveNoun.endsWith("s") ? possesiveNoun + "' " + noun : possesiveNoun + "'s " + noun;
|
||||
}
|
||||
|
||||
public static boolean startsWithVowel(String word)
|
||||
{
|
||||
if(word == null || word.isEmpty()) return false;
|
||||
|
||||
char v = word.toLowerCase().charAt(0);
|
||||
|
||||
for(char c : VOWELS)
|
||||
{
|
||||
if(c == v) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static String getPronoun(String word)
|
||||
{
|
||||
return startsWithVowel(word) ? "an" : "a";
|
||||
}
|
||||
|
||||
public static String prefixPronoun(String word)
|
||||
{
|
||||
return getPronoun(word) + " " + word;
|
||||
}
|
||||
|
||||
/**
|
||||
* Do a replaceAll on all strings in the array. It will replace the strings inside
|
||||
* the given array. The returned array is the same instance as the one provided.
|
||||
*/
|
||||
public static String[] replaceAll(String[] array, String regex, String replacement)
|
||||
{
|
||||
if(array == null) return null;
|
||||
|
||||
for(int i = 0; i < array.length; i++)
|
||||
{
|
||||
if(array[i] == null) continue;
|
||||
array[i] = array[i].replaceAll(regex, replacement);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
}
|
@ -54,6 +54,7 @@ public class WorldUtil
|
||||
generator = server.getGenerator(name);
|
||||
}
|
||||
|
||||
|
||||
Convertable converter = new WorldLoaderServer(server.getWorldContainer());
|
||||
if (converter.isConvertable(name))
|
||||
{
|
||||
|
@ -0,0 +1,24 @@
|
||||
package mineplex.core.common.util.worldgen;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
|
||||
/**
|
||||
* A simple clean room void chunk generator
|
||||
*/
|
||||
|
||||
public class WorldGenCleanRoom extends ChunkGenerator
|
||||
{
|
||||
|
||||
/**
|
||||
* Creates a clean void chunk with no blocks
|
||||
*/
|
||||
@Override
|
||||
public ChunkData generateChunkData(World world, Random random, int x, int z, BiomeGrid biome)
|
||||
{
|
||||
return createChunkData(world);
|
||||
}
|
||||
|
||||
}
|
@ -1,33 +1,26 @@
|
||||
package mineplex.core.achievement;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.achievement.command.StatsCommand;
|
||||
import mineplex.core.achievement.ui.AchievementShop;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.elo.EloManager;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.incognito.IncognitoManager;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
import mineplex.core.stats.event.StatChangeEvent;
|
||||
|
||||
public class AchievementManager extends MiniPlugin
|
||||
{
|
||||
private IncognitoManager _incognitoManager;
|
||||
private StatsManager _statsManager;
|
||||
private EloManager _eloManager;
|
||||
|
||||
@ -39,10 +32,11 @@ public class AchievementManager extends MiniPlugin
|
||||
|
||||
private boolean _shopEnabled = true;
|
||||
|
||||
public AchievementManager(StatsManager statsManager, CoreClientManager clientManager, DonationManager donationManager, EloManager eloManager)
|
||||
public AchievementManager(StatsManager statsManager, CoreClientManager clientManager, DonationManager donationManager, IncognitoManager incognitoManager, EloManager eloManager)
|
||||
{
|
||||
super("Achievement Manager", statsManager.getPlugin());
|
||||
|
||||
_incognitoManager = incognitoManager;
|
||||
_statsManager = statsManager;
|
||||
_eloManager = eloManager;
|
||||
_shop = new AchievementShop(this, _statsManager, clientManager, donationManager, "Achievement");
|
||||
@ -221,4 +215,9 @@ public class AchievementManager extends MiniPlugin
|
||||
{
|
||||
_shopEnabled = var;
|
||||
}
|
||||
|
||||
public IncognitoManager getIncognito()
|
||||
{
|
||||
return _incognitoManager;
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,11 @@ public class StatsCommand extends CommandBase<AchievementManager>
|
||||
return;
|
||||
}
|
||||
|
||||
if (/* StaffServer special case */Plugin.getIncognito() != null && Plugin.getIncognito().Get(target).Hidden)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Plugin.openShop(caller, target);
|
||||
}
|
||||
}
|
||||
|
@ -54,22 +54,28 @@ public class Blood extends MiniPlugin
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void display(BloodEvent event)
|
||||
{
|
||||
for (int i = 0 ; i < event.getParticles() ; i++)
|
||||
if(event.isCancelled()) return;
|
||||
|
||||
if(event.getMaterial() != null && event.getMaterial() != Material.AIR)
|
||||
{
|
||||
Item item = event.getLocation().getWorld().dropItem(event.getLocation(),
|
||||
new ItemBuilder(event.getMaterial(), 1, event.getMaterialData()).setTitle("" + System.nanoTime()).build());
|
||||
for (int i = 0 ; i < event.getParticles() ; i++)
|
||||
{
|
||||
Item item = event.getLocation().getWorld().dropItem(event.getLocation(),
|
||||
new ItemBuilder(event.getMaterial(), 1, event.getMaterialData()).setTitle("" + System.nanoTime()).build());
|
||||
|
||||
item.setVelocity(new Vector((Math.random() - 0.5)*event.getVelocityMult(),Math.random()*event.getVelocityMult(),(Math.random() - 0.5)*event.getVelocityMult()));
|
||||
item.setVelocity(new Vector((Math.random() - 0.5)*event.getVelocityMult(),Math.random()*event.getVelocityMult(),(Math.random() - 0.5)*event.getVelocityMult()));
|
||||
|
||||
item.setPickupDelay(999999);
|
||||
item.setPickupDelay(999999);
|
||||
|
||||
_blood.put(item, event.getTicks());
|
||||
_blood.put(item, event.getTicks());
|
||||
}
|
||||
}
|
||||
|
||||
if (event.getBloodStep())
|
||||
event.getLocation().getWorld().playEffect(event.getLocation(), Effect.STEP_SOUND, 55);
|
||||
|
||||
event.getLocation().getWorld().playSound(event.getLocation(), event.getSound(), event.getSoundVolume(), event.getSoundPitch());
|
||||
if(event.getSound() != null)
|
||||
event.getLocation().getWorld().playSound(event.getLocation(), event.getSound(), event.getSoundVolume(), event.getSoundPitch());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -21,6 +21,7 @@ import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.donation.GiveDonorData;
|
||||
import mineplex.core.facebook.FacebookManager;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.hologram.Hologram;
|
||||
import mineplex.core.hologram.HologramManager;
|
||||
import mineplex.core.inventory.ClientItem;
|
||||
@ -157,7 +158,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
updateOffSet();
|
||||
}
|
||||
|
||||
public BonusManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, PollManager pollManager, NpcManager npcManager, HologramManager hologramManager, StatsManager statsManager, InventoryManager inventoryManager, PetManager petManager, FacebookManager facebookManager)
|
||||
public BonusManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, PollManager pollManager, NpcManager npcManager, HologramManager hologramManager, StatsManager statsManager, InventoryManager inventoryManager, PetManager petManager, FacebookManager facebookManager, GadgetManager gadgetManager)
|
||||
{
|
||||
super("Bonus", plugin);
|
||||
_repository = new BonusRepository(plugin, this, donationManager);
|
||||
@ -167,12 +168,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
_hologramManager = hologramManager;
|
||||
_inventoryManager = inventoryManager;
|
||||
|
||||
_rewardManager = new RewardManager(clientManager, statusManager, donationManager, inventoryManager, petManager, statsManager,
|
||||
100, 250,
|
||||
500, 1000,
|
||||
4000, 6000,
|
||||
12000, 32000,
|
||||
true, true);
|
||||
_rewardManager = new RewardManager(_clientManager, _donationManager, _inventoryManager, petManager, statsManager, gadgetManager);
|
||||
|
||||
_pollManager = pollManager;
|
||||
_statsManager = statsManager;
|
||||
@ -912,7 +908,11 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
|
||||
if (client.getHologram() == null)
|
||||
{
|
||||
double yAdd = 2.45;
|
||||
double yAdd = 2.3;
|
||||
if(!UtilPlayer.is1_9(player))
|
||||
{
|
||||
yAdd = 2.45;
|
||||
}
|
||||
hologram = new Hologram(_hologramManager, _carlNpc.getLocation().clone().add(0, yAdd, 0), "");
|
||||
hologram.setHologramTarget(Hologram.HologramTarget.WHITELIST);
|
||||
hologram.addPlayer(player);
|
||||
|
@ -12,6 +12,7 @@ import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.reward.Reward;
|
||||
import mineplex.core.reward.RewardData;
|
||||
import mineplex.core.reward.RewardManager;
|
||||
import mineplex.core.reward.RewardPool.Type;
|
||||
import mineplex.core.reward.RewardRarity;
|
||||
import mineplex.core.reward.RewardType;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
@ -101,11 +102,11 @@ public class SpinGui extends SimpleGui
|
||||
{
|
||||
if (i != _stopSpinnerAt + 4)
|
||||
{
|
||||
_rewards[i] = rewardManager.nextReward(player, null, false, RewardType.SpinnerFiller, true);
|
||||
_rewards[i] = rewardManager.nextReward(player, Type.CARL_SPINNER, null, false, RewardType.SpinnerFiller, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
_rewards[i] = rewardManager.nextReward(player, null, false, RewardType.SpinnerReal, true);
|
||||
_rewards[i] = rewardManager.nextReward(player, Type.CARL_SPINNER, null, false, RewardType.SpinnerReal, true);
|
||||
_reward = _rewards[i];
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,10 @@
|
||||
package mineplex.core.cosmetic.ui.button;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.ArrowTrailPage;
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
|
||||
public class OpenArrowTrails extends OpenPageButton
|
||||
{
|
||||
|
@ -1,12 +1,10 @@
|
||||
package mineplex.core.cosmetic.ui.button;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.DeathEffectPage;
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
|
||||
public class OpenDeathAnimations extends OpenPageButton
|
||||
{
|
||||
|
@ -1,12 +1,10 @@
|
||||
package mineplex.core.cosmetic.ui.button;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.DoubleJumpPage;
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
|
||||
public class OpenDoubleJump extends OpenPageButton
|
||||
{
|
||||
|
@ -1,12 +1,10 @@
|
||||
package mineplex.core.cosmetic.ui.button;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.GadgetPage;
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
public class OpenGadgets extends OpenPageButton
|
||||
{
|
||||
|
@ -0,0 +1,21 @@
|
||||
package mineplex.core.cosmetic.ui.button;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.GameModifierPage;
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
|
||||
public class OpenGameModifiers extends OpenPageButton
|
||||
{
|
||||
public OpenGameModifiers(Menu menu, Gadget active)
|
||||
{
|
||||
super(menu, active);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void leftClick(Player player)
|
||||
{
|
||||
getMenu().getShop().openPageForPlayer(player, new GameModifierPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Game Modifiers", player));
|
||||
}
|
||||
}
|
@ -1,14 +1,13 @@
|
||||
package mineplex.core.cosmetic.ui.button;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.cosmetic.ui.page.MountPage;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.mount.Mount;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.cosmetic.ui.page.MountPage;
|
||||
import mineplex.core.mount.Mount;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
|
||||
public class OpenMounts implements IButton
|
||||
{
|
||||
private Menu _menu;
|
||||
|
@ -1,11 +1,9 @@
|
||||
package mineplex.core.cosmetic.ui.button;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
|
||||
public class OpenMusic extends OpenPageButton
|
||||
{
|
||||
|
@ -1,13 +1,10 @@
|
||||
package mineplex.core.cosmetic.ui.button;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.cosmetic.ui.page.ParticlePage;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
public class OpenParticles extends OpenPageButton
|
||||
{
|
||||
|
@ -1,14 +1,12 @@
|
||||
package mineplex.core.cosmetic.ui.button;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.cosmetic.ui.page.MountPage;
|
||||
import mineplex.core.cosmetic.ui.page.PetPage;
|
||||
import mineplex.core.pet.Pet;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.cosmetic.ui.page.PetPage;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
|
||||
public class OpenPets implements IButton
|
||||
{
|
||||
private Menu _menu;
|
||||
|
@ -0,0 +1,21 @@
|
||||
package mineplex.core.cosmetic.ui.button;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.cosmetic.ui.page.WinEffectPage;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
|
||||
public class OpenWinEffect extends OpenPageButton
|
||||
{
|
||||
public OpenWinEffect(Menu menu, Gadget active)
|
||||
{
|
||||
super(menu, active);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void leftClick(Player player)
|
||||
{
|
||||
getMenu().getShop().openPageForPlayer(player, new WinEffectPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Win Effects", player));
|
||||
}
|
||||
}
|
@ -1,10 +1,5 @@
|
||||
package mineplex.core.cosmetic.ui.page;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -16,8 +11,8 @@ import mineplex.core.common.util.C;
|
||||
import mineplex.core.cosmetic.CosmeticManager;
|
||||
import mineplex.core.cosmetic.ui.CosmeticShop;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.gadget.gadgets.outfit.OutfitRaveSuit;
|
||||
import mineplex.core.gadget.gadgets.outfit.OutfitSpaceSuit;
|
||||
import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuit;
|
||||
import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuit;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.gadget.types.ItemGadget;
|
||||
|
@ -0,0 +1,81 @@
|
||||
package mineplex.core.cosmetic.ui.page;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.cosmetic.CosmeticManager;
|
||||
import mineplex.core.cosmetic.ui.CosmeticShop;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType;
|
||||
import mineplex.core.gadget.types.GadgetGameModifier;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
|
||||
public class GameModifierPage extends GadgetPage
|
||||
{
|
||||
|
||||
public GameModifierPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name,
|
||||
Player player)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, name, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void buildPage()
|
||||
{
|
||||
int slot = 19;
|
||||
|
||||
for (GameModifierType type : GameModifierType.values())
|
||||
{
|
||||
int own = 0;
|
||||
int total = 0;
|
||||
for(GadgetGameModifier g : getPlugin().getGadgetManager().getGameModifiers(type)) {
|
||||
if(g.ownsGadget(getPlayer())) own++;
|
||||
total++;
|
||||
}
|
||||
if (total == 0)
|
||||
continue;
|
||||
ItemStack item = type.getItemStack();
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
|
||||
List<String> lore = meta.getLore();
|
||||
lore.add(0, " ");
|
||||
lore.add(" ");
|
||||
lore.add(C.cWhite + "You own " + own + "/" + total);
|
||||
lore.add(" ");
|
||||
lore.add(C.cGreen + "Left-click to view Sub-Category");
|
||||
|
||||
meta.setLore(lore);
|
||||
item.setItemMeta(meta);
|
||||
|
||||
addButton(slot, item, new IButton()
|
||||
{
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
getShop().openPageForPlayer(player, new GameModifierSubPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), type.getName(), player, type));
|
||||
}
|
||||
});
|
||||
|
||||
slot++;
|
||||
if(slot%9 == 8) slot += 2;
|
||||
}
|
||||
|
||||
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
|
||||
{
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,108 @@
|
||||
package mineplex.core.cosmetic.ui.page;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.cosmetic.CosmeticManager;
|
||||
import mineplex.core.cosmetic.ui.CosmeticShop;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType;
|
||||
import mineplex.core.gadget.types.GadgetGameModifier;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GameModifierSubPage extends GadgetPage
|
||||
{
|
||||
|
||||
private final GameModifierType _type;
|
||||
|
||||
public GameModifierSubPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager,
|
||||
String name, Player player, GameModifierType gameType)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, name, player);
|
||||
_type = gameType;
|
||||
buildPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void buildPage()
|
||||
{
|
||||
if(_type == null) return;
|
||||
|
||||
int slot = 19;
|
||||
|
||||
if (_type.hasKits())
|
||||
{
|
||||
for (KitModifierType kitModifierType : KitModifierType.values())
|
||||
{
|
||||
if (kitModifierType.getGameModifierType().equals(_type))
|
||||
{
|
||||
int own = 0;
|
||||
int total = 0;
|
||||
for (GadgetGameModifier g : getPlugin().getGadgetManager().getGameModifiers(kitModifierType))
|
||||
{
|
||||
if (g.ownsGadget(getPlayer())) own++;
|
||||
total++;
|
||||
}
|
||||
|
||||
ItemStack itemStack = kitModifierType.getItemStack();
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
|
||||
List<String> lore = itemMeta.getLore();
|
||||
lore.add(0, " ");
|
||||
lore.add(" ");
|
||||
lore.add(C.cWhite + "You own " + own + "/" + total);
|
||||
lore.add(" ");
|
||||
lore.add(C.cGreen + "Left-click to view Kit Modifiers");
|
||||
|
||||
itemMeta.setLore(lore);
|
||||
itemStack.setItemMeta(itemMeta);
|
||||
|
||||
addButton(slot, itemStack, new IButton()
|
||||
{
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
getShop().openPageForPlayer(player, new KitGameModifierPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), kitModifierType.getKitName(), player, _type, kitModifierType));
|
||||
}
|
||||
});
|
||||
|
||||
slot++;
|
||||
|
||||
if(slot%9 == 8) slot += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (GadgetGameModifier gadget : getPlugin().getGadgetManager().getGameModifiers(_type))
|
||||
{
|
||||
|
||||
addGadget(gadget, slot);
|
||||
|
||||
if (gadget.IsActive(getPlayer()))
|
||||
addGlow(slot);
|
||||
|
||||
slot++;
|
||||
|
||||
if(slot%9 == 8) slot += 2;
|
||||
}
|
||||
}
|
||||
|
||||
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
|
||||
{
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
getShop().openPageForPlayer(getPlayer(), new GameModifierPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Game Modifiers", player));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
package mineplex.core.cosmetic.ui.page;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.cosmetic.CosmeticManager;
|
||||
import mineplex.core.cosmetic.ui.CosmeticShop;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType;
|
||||
import mineplex.core.gadget.types.GadgetGameModifier;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
public class KitGameModifierPage extends GadgetPage
|
||||
{
|
||||
|
||||
private final GameModifierType _type;
|
||||
private final KitModifierType _kitType;
|
||||
|
||||
public KitGameModifierPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager,
|
||||
String name, Player player, GameModifierType gameType, KitModifierType kitType)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, name, player);
|
||||
_type = gameType;
|
||||
_kitType = kitType;
|
||||
buildPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void buildPage()
|
||||
{
|
||||
if(_type == null) return;
|
||||
|
||||
int slot = 19;
|
||||
|
||||
for (GadgetGameModifier gadget : getPlugin().getGadgetManager().getGameModifiers(_kitType))
|
||||
{
|
||||
if (gadget instanceof KitGameModifier)
|
||||
{
|
||||
KitGameModifier kitGameModifier = (KitGameModifier) gadget;
|
||||
if (kitGameModifier.getKitType().equals(_kitType))
|
||||
{
|
||||
addGadget(gadget, slot);
|
||||
|
||||
if (gadget.IsActive(getPlayer()))
|
||||
addGlow(slot);
|
||||
|
||||
slot++;
|
||||
|
||||
if(slot%9 == 8) slot += 2;
|
||||
}
|
||||
else
|
||||
continue;
|
||||
}
|
||||
else
|
||||
continue;
|
||||
}
|
||||
|
||||
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
|
||||
{
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
getShop().openPageForPlayer(getPlayer(), new GameModifierSubPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Game Modifiers", player, _type));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -2,10 +2,8 @@ package mineplex.core.cosmetic.ui.page;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.EntityType;
|
||||
@ -13,14 +11,11 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.CurrencyType;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.NautArrayList;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.common.util.UtilUI;
|
||||
import mineplex.core.cosmetic.CosmeticManager;
|
||||
import mineplex.core.cosmetic.ui.CosmeticShop;
|
||||
import mineplex.core.cosmetic.ui.button.OpenArrowTrails;
|
||||
@ -28,24 +23,22 @@ import mineplex.core.cosmetic.ui.button.OpenCostumes;
|
||||
import mineplex.core.cosmetic.ui.button.OpenDeathAnimations;
|
||||
import mineplex.core.cosmetic.ui.button.OpenDoubleJump;
|
||||
import mineplex.core.cosmetic.ui.button.OpenGadgets;
|
||||
import mineplex.core.cosmetic.ui.button.OpenGameModifiers;
|
||||
import mineplex.core.cosmetic.ui.button.OpenHats;
|
||||
import mineplex.core.cosmetic.ui.button.OpenMorphs;
|
||||
import mineplex.core.cosmetic.ui.button.OpenMounts;
|
||||
import mineplex.core.cosmetic.ui.button.OpenMusic;
|
||||
import mineplex.core.cosmetic.ui.button.OpenParticles;
|
||||
import mineplex.core.cosmetic.ui.button.OpenPets;
|
||||
import mineplex.core.cosmetic.ui.button.OpenWinEffect;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.donation.Donor;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.mount.Mount;
|
||||
import mineplex.core.pet.Pet;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.core.shop.page.ConfirmationPage;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import mineplex.core.treasure.TreasureKey;
|
||||
import mineplex.core.treasure.TreasureType;
|
||||
|
||||
public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
{
|
||||
@ -76,14 +69,16 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
int arrowSlot = 12;//slots[1];
|
||||
int jumpSlot = 14;//slots[2];
|
||||
int deathSlot = 16;//slots[3];
|
||||
int gadgetSlot = 28;//slots[4];
|
||||
int morphSlot = 30;//slots[5];
|
||||
int mountSlot = 32;//slots[6];
|
||||
int petSlot = 34;//slots[7];
|
||||
int hatSlot = 46;//slots[8];
|
||||
int costumeSlot = 48;//slots[9];
|
||||
int musicSlot = 50;//slots[10];
|
||||
int tauntSlot = 52;//slots[11];
|
||||
int gadgetSlot = 27;//slots[4];
|
||||
int morphSlot = 29;//slots[5];
|
||||
int mountSlot = 31;//slots[6];
|
||||
int petSlot = 33;//slots[7];
|
||||
int hatSlot = 35;//slots[8];
|
||||
int costumeSlot = 45;//slots[9];
|
||||
int musicSlot = 47;//slots[10];
|
||||
int tauntSlot = 49;//slots[11];
|
||||
int winEffectSlot = 51;
|
||||
int gameModifierSlot = 53;
|
||||
|
||||
EnumMap<GadgetType, Integer> ownedCount = new EnumMap<GadgetType, Integer>(GadgetType.class);
|
||||
EnumMap<GadgetType, Integer> maxCount = new EnumMap<GadgetType, Integer>(GadgetType.class);
|
||||
@ -146,7 +141,7 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
|
||||
type = GadgetType.ArrowTrail;
|
||||
lore = getLore(ownedCount.get(type), maxCount.get(type), "Your arrows will now leave particle trails as they soar through the air.", "Visible in Games", enabled.get(type));
|
||||
addButton(arrowSlot, new ShopItem(Material.ARROW, "Arrow Trails", lore, 1, false), new OpenArrowTrails(this, enabled.get(type)));
|
||||
addButton(arrowSlot, new ShopItem(Material.ARROW, "Arrow Effects", lore, 1, false), new OpenArrowTrails(this, enabled.get(type)));
|
||||
if (enabled.containsKey(type)) addGlow(arrowSlot);
|
||||
|
||||
type = GadgetType.DoubleJump;
|
||||
@ -183,7 +178,8 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
if (enabled.containsKey(type)) addGlow(hatSlot);
|
||||
|
||||
type = GadgetType.Costume;
|
||||
lore = getLore(ownedCount.get(type), maxCount.get(type), "Sometimes going out calls for special clothes! Gain bonus effects for matching outfit.", "Usable in Lobbies", enabled.get(type));
|
||||
// Fixes more than 8 costumes being counted, even without the WindUp
|
||||
lore = getLore((ownedCount.get(type) > 8) ? 8 : ownedCount.get(type), /*maxCount.get(type)*/ 8, "Sometimes going out calls for special clothes! Gain bonus effects for matching outfit.", "Usable in Lobbies", enabled.get(type));
|
||||
addButton(costumeSlot, new ShopItem(Material.DIAMOND_CHESTPLATE, "Costumes", lore, 1, false), new OpenCostumes(this, enabled.get(type)));
|
||||
if (enabled.containsKey(type)) addGlow(costumeSlot);
|
||||
|
||||
@ -200,6 +196,17 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
player.sendMessage(F.main("Shop", "Coming soon!"));
|
||||
}
|
||||
});
|
||||
|
||||
type = GadgetType.WinEffect;
|
||||
lore = getLore(ownedCount.get(type), maxCount.get(type), "Winning a game with your friends all good and dandy, but then being able to also show off awsome effects is even more fun!", "Usable in Lobbies", enabled.get(type));
|
||||
addButton(winEffectSlot, new ShopItem(Material.CAKE, "Win Effects", lore, 1, false), new OpenWinEffect(this, enabled.get(type)));
|
||||
if (enabled.containsKey(type)) addGlow(winEffectSlot);
|
||||
|
||||
|
||||
type = GadgetType.GameModifier;
|
||||
lore = getLore(ownedCount.get(type), maxCount.get(type), "Cosmetic effects which changes appearances of objects in game", "Visible in Games", enabled.get(type));
|
||||
addButton(gameModifierSlot, new ShopItem(Material.TORCH, "Game Modifiers", lore, 1, false), new OpenGameModifiers(this, enabled.get(type)));
|
||||
if (enabled.containsKey(type)) addGlow(gameModifierSlot);
|
||||
}
|
||||
|
||||
private String[] getLore(int ownedCount, int maxCount, String info, String visibility, Gadget enabled)
|
||||
|
@ -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()
|
||||
|
@ -0,0 +1,53 @@
|
||||
package mineplex.core.cosmetic.ui.page;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.cosmetic.CosmeticManager;
|
||||
import mineplex.core.cosmetic.ui.CosmeticShop;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
|
||||
public class WinEffectPage extends GadgetPage
|
||||
{
|
||||
|
||||
public WinEffectPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name,
|
||||
Player player)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, name, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void buildPage()
|
||||
{
|
||||
int slot = 19;
|
||||
|
||||
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.WinEffect))
|
||||
{
|
||||
addGadget(gadget, slot);
|
||||
|
||||
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.WinEffect) == gadget)
|
||||
addGlow(slot);
|
||||
|
||||
slot++;
|
||||
|
||||
if (slot == 26)
|
||||
slot = 28;
|
||||
}
|
||||
|
||||
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
|
||||
{
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@ -610,6 +610,8 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
||||
packetInfo.setCancelled(true);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Why is this here???
|
||||
else if (packet instanceof PacketPlayOutAnimation)
|
||||
{
|
||||
int entityId = ((PacketPlayOutAnimation) packet).a;
|
||||
@ -619,6 +621,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
||||
packetInfo.setCancelled(true);
|
||||
}
|
||||
}
|
||||
*/
|
||||
else if (packet instanceof PacketPlayOutEntityMetadata)
|
||||
{
|
||||
int entityId = ((PacketPlayOutEntityMetadata) packet).a;
|
||||
|
@ -1,10 +1,14 @@
|
||||
package mineplex.core.disguise.disguises;
|
||||
|
||||
import mineplex.core.common.*;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.DummyEntity;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import net.minecraft.server.v1_8_R3.DataWatcher;
|
||||
import net.minecraft.server.v1_8_R3.Entity;
|
||||
import net.minecraft.server.v1_8_R3.EntityPlayer;
|
||||
@ -108,4 +112,23 @@ public abstract class DisguiseBase
|
||||
protected abstract float getVolume();
|
||||
|
||||
protected abstract float getPitch();
|
||||
|
||||
public List<Player> getTrackedPlayers()
|
||||
{
|
||||
List<Player> players = new ArrayList<>();
|
||||
IntHashMap<EntityTrackerEntry> tracker = ((WorldServer) Entity.world).tracker.trackedEntities;
|
||||
for(EntityPlayer ep : tracker.get(Entity.getId()).trackedPlayers)
|
||||
{
|
||||
players.add(ep.getBukkitEntity());
|
||||
}
|
||||
return players;
|
||||
}
|
||||
|
||||
public void sendPacket(Packet... packet)
|
||||
{
|
||||
for(Player p : getTrackedPlayers()) {
|
||||
UtilPlayer.sendPacket(p, packet);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -8,7 +8,16 @@ public abstract class DisguiseHuman extends DisguiseLiving
|
||||
{
|
||||
super(entity);
|
||||
|
||||
DataWatcher.a(10, (byte) 0, EntityHuman.META_SKIN, (byte) 0); // todo
|
||||
byte skin = 0;
|
||||
skin |= (1 << 0); //Enable Cape
|
||||
skin |= (1 << 1); //Enable Jacket
|
||||
skin |= (1 << 2); //Enable Left Sleeve
|
||||
skin |= (1 << 3); //Enable Right Sleeve
|
||||
skin |= (1 << 4); //Enable Left Pants
|
||||
skin |= (1 << 5); //Enable Right Pants
|
||||
skin |= (1 << 6); //Enable Hat
|
||||
|
||||
DataWatcher.a(10, (byte) skin, EntityHuman.META_SKIN, (byte) skin);
|
||||
DataWatcher.a(16, (byte) 1, EntityHuman.META_CAPE, (byte) 1);
|
||||
DataWatcher.a(17, Float.valueOf(0.0F), EntityHuman.META_SCALED_HEALTH, 0f);
|
||||
DataWatcher.a(18, Integer.valueOf(0), EntityHuman.META_SCORE, 0);
|
||||
|
@ -8,11 +8,17 @@ import org.bukkit.block.BlockFace;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import mineplex.core.common.skin.SkinData;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import net.minecraft.server.v1_8_R3.EntityPlayer;
|
||||
import net.minecraft.server.v1_8_R3.EntityTrackerEntry;
|
||||
import net.minecraft.server.v1_8_R3.IntHashMap;
|
||||
import net.minecraft.server.v1_8_R3.EntityHuman;
|
||||
import net.minecraft.server.v1_8_R3.MathHelper;
|
||||
import net.minecraft.server.v1_8_R3.Packet;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutAnimation;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutNamedEntitySpawn;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo;
|
||||
import net.minecraft.server.v1_8_R3.WorldServer;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo.EnumPlayerInfoAction;
|
||||
import net.minecraft.server.v1_8_R3.WorldSettings;
|
||||
|
||||
@ -155,4 +161,13 @@ public class DisguisePlayer extends DisguiseHuman
|
||||
{
|
||||
return _profile.getName();
|
||||
}
|
||||
|
||||
public void sendHit()
|
||||
{
|
||||
PacketPlayOutAnimation packet = new PacketPlayOutAnimation();
|
||||
packet.a = GetEntityId();
|
||||
packet.b = 0;
|
||||
|
||||
sendPacket(packet);
|
||||
}
|
||||
}
|
||||
|
@ -4,12 +4,8 @@ import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import mineplex.core.gadget.gadgets.hat.HatCompanion;
|
||||
import mineplex.core.gadget.gadgets.hat.HatLovestruck;
|
||||
import mineplex.core.gadget.gadgets.hat.HatSecretPackage;
|
||||
import mineplex.core.gadget.gadgets.hat.HatTeddyBear;
|
||||
import mineplex.core.gadget.gadgets.item.*;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -35,26 +31,75 @@ import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.disguise.DisguiseManager;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.gadget.commands.AmmoCommand;
|
||||
import mineplex.core.gadget.commands.UnlockCosmeticsCommand;
|
||||
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
|
||||
import mineplex.core.gadget.event.GadgetEnableEvent;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailBlood;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailCandyCane;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailConfetti;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailCupid;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailEmerald;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailEnchant;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailFrostLord;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailHearts;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailMusic;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailShadow;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailStorm;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailTitan;
|
||||
import mineplex.core.gadget.gadgets.death.DeathBlood;
|
||||
import mineplex.core.gadget.gadgets.death.DeathCandyCane;
|
||||
import mineplex.core.gadget.gadgets.death.DeathCupidsBrokenHeart;
|
||||
import mineplex.core.gadget.gadgets.death.DeathEmerald;
|
||||
import mineplex.core.gadget.gadgets.death.DeathEnchant;
|
||||
import mineplex.core.gadget.gadgets.death.DeathFrostLord;
|
||||
import mineplex.core.gadget.gadgets.death.DeathHearts;
|
||||
import mineplex.core.gadget.gadgets.death.DeathMusic;
|
||||
import mineplex.core.gadget.gadgets.death.DeathPinataBurst;
|
||||
import mineplex.core.gadget.gadgets.death.DeathShadow;
|
||||
import mineplex.core.gadget.gadgets.death.DeathStorm;
|
||||
import mineplex.core.gadget.gadgets.death.DeathTitan;
|
||||
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpBlood;
|
||||
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpCandyCane;
|
||||
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpCupidsWings;
|
||||
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpEmerald;
|
||||
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpEnchant;
|
||||
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpFirecracker;
|
||||
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpFrostLord;
|
||||
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpHearts;
|
||||
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpMusic;
|
||||
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpShadow;
|
||||
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpStorm;
|
||||
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpTitan;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.GameModifierMineStrikeSkin;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.MineStrikeSkin;
|
||||
import mineplex.core.gadget.gadgets.hat.HatCoal;
|
||||
import mineplex.core.gadget.gadgets.hat.HatCompanionBlock;
|
||||
import mineplex.core.gadget.gadgets.hat.HatGrinch;
|
||||
import mineplex.core.gadget.gadgets.hat.HatLovestruck;
|
||||
import mineplex.core.gadget.gadgets.hat.HatPresent;
|
||||
import mineplex.core.gadget.gadgets.hat.HatRudolph;
|
||||
import mineplex.core.gadget.gadgets.hat.HatSanta;
|
||||
import mineplex.core.gadget.gadgets.hat.HatSecretPackage;
|
||||
import mineplex.core.gadget.gadgets.hat.HatSnowman;
|
||||
import mineplex.core.gadget.gadgets.hat.HatTeddyBear;
|
||||
import mineplex.core.gadget.gadgets.item.ItemBatGun;
|
||||
import mineplex.core.gadget.gadgets.item.ItemBow;
|
||||
import mineplex.core.gadget.gadgets.item.ItemCoal;
|
||||
import mineplex.core.gadget.gadgets.item.ItemCoinBomb;
|
||||
import mineplex.core.gadget.gadgets.item.ItemDuelingSword;
|
||||
import mineplex.core.gadget.gadgets.item.ItemEtherealPearl;
|
||||
import mineplex.core.gadget.gadgets.item.ItemFirework;
|
||||
import mineplex.core.gadget.gadgets.item.ItemFleshHook;
|
||||
import mineplex.core.gadget.gadgets.item.ItemFlowerGift;
|
||||
import mineplex.core.gadget.gadgets.item.ItemFreezeCannon;
|
||||
import mineplex.core.gadget.gadgets.item.ItemLovePotion;
|
||||
import mineplex.core.gadget.gadgets.item.ItemMelonLauncher;
|
||||
import mineplex.core.gadget.gadgets.item.ItemPaintballGun;
|
||||
import mineplex.core.gadget.gadgets.item.ItemPaintbrush;
|
||||
import mineplex.core.gadget.gadgets.item.ItemPartyPopper;
|
||||
import mineplex.core.gadget.gadgets.item.ItemSnowball;
|
||||
import mineplex.core.gadget.gadgets.item.ItemTNT;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphBat;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphBlaze;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphBlock;
|
||||
@ -70,38 +115,63 @@ import mineplex.core.gadget.gadgets.morph.MorphSnowman;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphTitan;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphVillager;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphWither;
|
||||
import mineplex.core.gadget.gadgets.outfit.OutfitRaveSuitBoots;
|
||||
import mineplex.core.gadget.gadgets.outfit.OutfitRaveSuitChestplate;
|
||||
import mineplex.core.gadget.gadgets.outfit.OutfitRaveSuitHelmet;
|
||||
import mineplex.core.gadget.gadgets.outfit.OutfitRaveSuitLeggings;
|
||||
import mineplex.core.gadget.gadgets.outfit.OutfitSpaceSuitBoots;
|
||||
import mineplex.core.gadget.gadgets.outfit.OutfitSpaceSuitChestplate;
|
||||
import mineplex.core.gadget.gadgets.outfit.OutfitSpaceSuitHelmet;
|
||||
import mineplex.core.gadget.gadgets.outfit.OutfitSpaceSuitLeggings;
|
||||
import mineplex.core.gadget.gadgets.outfit.OutfitTeam;
|
||||
import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitBoots;
|
||||
import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitChestplate;
|
||||
import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitHelmet;
|
||||
import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitLeggings;
|
||||
import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitBoots;
|
||||
import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitChestplate;
|
||||
import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitHelmet;
|
||||
import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitLeggings;
|
||||
import mineplex.core.gadget.gadgets.outfit.windupsuit.OutfitWindUpSuitBoosterManager;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleBlood;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleCandyCane;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleCoalFumes;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleEmerald;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleEnchant;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleFairy;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleFireRings;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleFoot;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleFrostLord;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleGreen;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleHeart;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleHelix;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleLegend;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleMusic;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticlePartyTime;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleRain;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleTitan;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleWingsAngel;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleWingsDemons;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleWingsInfernal;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleWingsPixie;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleYinYang;
|
||||
import mineplex.core.gadget.gadgets.wineffect.WinEffectBabyChicken;
|
||||
import mineplex.core.gadget.gadgets.wineffect.WinEffectFireworks;
|
||||
import mineplex.core.gadget.gadgets.wineffect.WinEffectFlames;
|
||||
import mineplex.core.gadget.gadgets.wineffect.WinEffectLavaTrap;
|
||||
import mineplex.core.gadget.gadgets.wineffect.WinEffectLightningStrike;
|
||||
import mineplex.core.gadget.gadgets.wineffect.WinEffectMrPunchMan;
|
||||
import mineplex.core.gadget.gadgets.wineffect.WinEffectPodium;
|
||||
import mineplex.core.gadget.gadgets.wineffect.WinEffectRiseOfTheElderGuardian;
|
||||
import mineplex.core.gadget.gadgets.wineffect.WinEffectSnowTrails;
|
||||
import mineplex.core.gadget.set.SetCandyCane;
|
||||
import mineplex.core.gadget.set.SetCupidsLove;
|
||||
import mineplex.core.gadget.set.SetEmerald;
|
||||
import mineplex.core.gadget.set.SetFrostLord;
|
||||
import mineplex.core.gadget.set.SetLove;
|
||||
import mineplex.core.gadget.set.SetRaveSuit;
|
||||
import mineplex.core.gadget.set.SetSpaceSuit;
|
||||
import mineplex.core.gadget.set.SetHowlingWinds;
|
||||
import mineplex.core.gadget.set.SetMusic;
|
||||
import mineplex.core.gadget.set.SetParty;
|
||||
import mineplex.core.gadget.set.SetShadow;
|
||||
import mineplex.core.gadget.set.SetTitan;
|
||||
import mineplex.core.gadget.set.SetVampire;
|
||||
import mineplex.core.gadget.set.SetWisdom;
|
||||
import mineplex.core.gadget.set.suits.SetRaveSuit;
|
||||
import mineplex.core.gadget.set.suits.SetSpaceSuit;
|
||||
import mineplex.core.gadget.types.ArrowEffectGadget;
|
||||
import mineplex.core.gadget.types.DeathEffectGadget;
|
||||
import mineplex.core.gadget.types.DoubleJumpEffectGadget;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetGameModifier;
|
||||
import mineplex.core.gadget.types.GadgetSet;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.gadget.types.ItemGadget;
|
||||
@ -109,6 +179,8 @@ import mineplex.core.gadget.types.MusicGadget;
|
||||
import mineplex.core.gadget.types.OutfitGadget;
|
||||
import mineplex.core.gadget.types.OutfitGadget.ArmorSlot;
|
||||
import mineplex.core.gadget.types.ParticleGadget;
|
||||
import mineplex.core.gadget.types.WinEffectGadget;
|
||||
import mineplex.core.hologram.HologramManager;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.mount.MountManager;
|
||||
import mineplex.core.mount.event.MountActivateEvent;
|
||||
@ -119,24 +191,26 @@ import mineplex.core.projectile.ProjectileManager;
|
||||
|
||||
public class GadgetManager extends MiniPlugin
|
||||
{
|
||||
private CoreClientManager _clientManager;
|
||||
private DonationManager _donationManager;
|
||||
private InventoryManager _inventoryManager;
|
||||
private PetManager _petManager;
|
||||
private PreferencesManager _preferencesManager;
|
||||
private DisguiseManager _disguiseManager;
|
||||
private BlockRestore _blockRestore;
|
||||
private ProjectileManager _projectileManager;
|
||||
private AchievementManager _achievementManager;
|
||||
private MountManager _mountManager;
|
||||
private PacketHandler _packetManager;
|
||||
private final CoreClientManager _clientManager;
|
||||
private final DonationManager _donationManager;
|
||||
private final InventoryManager _inventoryManager;
|
||||
private final PetManager _petManager;
|
||||
private final PreferencesManager _preferencesManager;
|
||||
private final DisguiseManager _disguiseManager;
|
||||
private final BlockRestore _blockRestore;
|
||||
private final ProjectileManager _projectileManager;
|
||||
private final AchievementManager _achievementManager;
|
||||
private final MountManager _mountManager;
|
||||
private final PacketHandler _packetManager;
|
||||
private final HologramManager _hologramManager;
|
||||
private final OutfitWindUpSuitBoosterManager _boosterManager;
|
||||
|
||||
private NautHashMap<GadgetType, List<Gadget>> _gadgets;
|
||||
|
||||
private NautHashMap<Player, Long> _lastMove = new NautHashMap<Player, Long>();
|
||||
private NautHashMap<Player, NautHashMap<GadgetType, Gadget>> _playerActiveGadgetMap = new NautHashMap<Player, NautHashMap<GadgetType, Gadget>>();
|
||||
private final NautHashMap<Player, Long> _lastMove = new NautHashMap<>();
|
||||
private final NautHashMap<Player, NautHashMap<GadgetType, Gadget>> _playerActiveGadgetMap = new NautHashMap<>();
|
||||
|
||||
private HashSet<GadgetSet> _sets = new HashSet<>();
|
||||
private final HashSet<GadgetSet> _sets = new HashSet<>();
|
||||
|
||||
private boolean _hideParticles = false;
|
||||
private int _activeItemSlot = 3;
|
||||
@ -145,7 +219,7 @@ public class GadgetManager extends MiniPlugin
|
||||
public GadgetManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager,
|
||||
MountManager mountManager, PetManager petManager, PreferencesManager preferencesManager,
|
||||
DisguiseManager disguiseManager, BlockRestore blockRestore, ProjectileManager projectileManager, AchievementManager achievementManager,
|
||||
PacketHandler packetHandler)
|
||||
PacketHandler packetHandler, HologramManager hologramManager)
|
||||
{
|
||||
super("Gadget Manager", plugin);
|
||||
|
||||
@ -160,22 +234,43 @@ public class GadgetManager extends MiniPlugin
|
||||
_achievementManager = achievementManager;
|
||||
_packetManager = packetHandler;
|
||||
_mountManager = mountManager;
|
||||
_hologramManager = hologramManager;
|
||||
_boosterManager = new OutfitWindUpSuitBoosterManager(this);
|
||||
|
||||
CreateGadgets();
|
||||
createSets();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCommands()
|
||||
{
|
||||
addCommand(new UnlockCosmeticsCommand(this));
|
||||
addCommand(new AmmoCommand(this));
|
||||
}
|
||||
|
||||
private void createSets()
|
||||
{
|
||||
//Particles
|
||||
addSet(new SetFrostLord(this));
|
||||
addSet(new SetCandyCane(this));
|
||||
addSet(new SetTitan(this));
|
||||
addSet(new SetLove(this));
|
||||
|
||||
// Removes Lovely Set (Duplicate of Cupid's Love)
|
||||
//addSet(new SetLove(this));
|
||||
|
||||
//Costumes
|
||||
addSet(new SetRaveSuit(this));
|
||||
addSet(new SetSpaceSuit(this));
|
||||
//Removes WindUp suit for now, as it's not going to be released
|
||||
//addSet(new SetWindUpSuit(this));
|
||||
addSet(new SetParty(this));
|
||||
addSet(new SetCupidsLove(this));
|
||||
addSet(new SetEmerald(this));
|
||||
addSet(new SetShadow(this));
|
||||
addSet(new SetWisdom(this));
|
||||
addSet(new SetHowlingWinds(this));
|
||||
addSet(new SetVampire(this));
|
||||
addSet(new SetMusic(this));
|
||||
}
|
||||
|
||||
private void CreateGadgets()
|
||||
@ -212,6 +307,11 @@ public class GadgetManager extends MiniPlugin
|
||||
addGadget(new OutfitSpaceSuitLeggings(this));
|
||||
addGadget(new OutfitSpaceSuitBoots(this));
|
||||
|
||||
//addGadget(new OutfitWindUpSuitHelmet(this));
|
||||
//addGadget(new OutfitWindUpSuitChestplate(this));
|
||||
//addGadget(new OutfitWindUpSuitLeggings(this));
|
||||
//addGadget(new OutfitWindUpSuitBoots(this));
|
||||
|
||||
addGadget(new OutfitTeam(this, "Team Helmet", -1, ArmorSlot.Helmet, Material.LEATHER_HELMET, (byte)0));
|
||||
addGadget(new OutfitTeam(this, "Team Shirt", -1, ArmorSlot.Chest, Material.LEATHER_CHESTPLATE, (byte)0));
|
||||
addGadget(new OutfitTeam(this, "Team Pants", -1, ArmorSlot.Legs, Material.LEATHER_LEGGINGS, (byte)0));
|
||||
@ -236,36 +336,71 @@ public class GadgetManager extends MiniPlugin
|
||||
|
||||
// Particles
|
||||
addGadget(new ParticleFoot(this));
|
||||
addGadget(new ParticleEnchant(this));
|
||||
addGadget(new ParticleFireRings(this));
|
||||
addGadget(new ParticleRain(this));
|
||||
addGadget(new ParticleHelix(this));
|
||||
addGadget(new ParticleGreen(this));
|
||||
addGadget(new ParticleHeart(this));
|
||||
addGadget(new ParticleFairy(this));
|
||||
addGadget(new ParticleLegend(this));
|
||||
addGadget(new ParticleFrostLord(this));
|
||||
addGadget(new ParticleTitan(this));
|
||||
addGadget(new ParticleCandyCane(this));
|
||||
addGadget(new ParticleCoalFumes(this));
|
||||
addGadget(new ParticlePartyTime(this));
|
||||
addGadget(new ParticleHeart(this));
|
||||
addGadget(new ParticleEmerald(this));
|
||||
addGadget(new ParticleWingsDemons(this));
|
||||
addGadget(new ParticleEnchant(this));
|
||||
addGadget(new ParticleRain(this));
|
||||
addGadget(new ParticleBlood(this));
|
||||
addGadget(new ParticleMusic(this));
|
||||
addGadget(new ParticleWingsAngel(this));
|
||||
addGadget(new ParticleWingsInfernal(this));
|
||||
addGadget(new ParticleWingsPixie(this));
|
||||
addGadget(new ParticleYinYang(this));
|
||||
|
||||
|
||||
// Arrow Trails
|
||||
addGadget(new ArrowTrailFrostLord(this));
|
||||
addGadget(new ArrowTrailTitan(this));
|
||||
addGadget(new ArrowTrailCandyCane(this));
|
||||
addGadget(new ArrowTrailHearts(this));
|
||||
addGadget(new ArrowTrailConfetti(this));
|
||||
addGadget(new ArrowTrailCupid(this));
|
||||
addGadget(new ArrowTrailEmerald(this));
|
||||
addGadget(new ArrowTrailShadow(this));
|
||||
addGadget(new ArrowTrailEnchant(this));
|
||||
addGadget(new ArrowTrailStorm(this));
|
||||
addGadget(new ArrowTrailBlood(this));
|
||||
addGadget(new ArrowTrailMusic(this));
|
||||
// Removes Lovely Set (Duplicate of Cupid's Love)
|
||||
//addGadget(new ArrowTrailHearts(this));
|
||||
|
||||
// Death Effect
|
||||
addGadget(new DeathFrostLord(this));
|
||||
addGadget(new DeathTitan(this));
|
||||
addGadget(new DeathCandyCane(this));
|
||||
addGadget(new DeathHearts(this));
|
||||
addGadget(new DeathPinataBurst(this));
|
||||
addGadget(new DeathCupidsBrokenHeart(this));
|
||||
addGadget(new DeathEmerald(this));
|
||||
addGadget(new DeathShadow(this));
|
||||
addGadget(new DeathEnchant(this));
|
||||
addGadget(new DeathStorm(this));
|
||||
addGadget(new DeathBlood(this));
|
||||
addGadget(new DeathMusic(this));
|
||||
// Removes Lovely Set (Duplicate of Cupid's Love)
|
||||
//addGadget(new DeathHearts(this));
|
||||
|
||||
// Double Jump
|
||||
addGadget(new DoubleJumpFrostLord(this));
|
||||
addGadget(new DoubleJumpTitan(this));
|
||||
addGadget(new DoubleJumpCandyCane(this));
|
||||
addGadget(new DoubleJumpHearts(this));
|
||||
addGadget(new DoubleJumpFirecracker(this));
|
||||
addGadget(new DoubleJumpCupidsWings(this));
|
||||
addGadget(new DoubleJumpEmerald(this));
|
||||
addGadget(new DoubleJumpShadow(this));
|
||||
addGadget(new DoubleJumpEnchant(this));
|
||||
addGadget(new DoubleJumpStorm(this));
|
||||
addGadget(new DoubleJumpBlood(this));
|
||||
addGadget(new DoubleJumpMusic(this));
|
||||
// Removes Lovely Set (Duplicate of Cupid's Love)
|
||||
//addGadget(new DoubleJumpHearts(this));
|
||||
|
||||
// Hat
|
||||
addGadget(new HatSanta(this));
|
||||
@ -274,32 +409,99 @@ public class GadgetManager extends MiniPlugin
|
||||
addGadget(new HatCoal(this));
|
||||
addGadget(new HatRudolph(this));
|
||||
addGadget(new HatGrinch(this));
|
||||
addGadget(new HatCompanionBlock(this));
|
||||
addGadget(new HatLovestruck(this));
|
||||
addGadget(new HatSecretPackage(this));
|
||||
addGadget(new HatTeddyBear(this));
|
||||
addGadget(new HatCompanion(this));
|
||||
|
||||
//Win Effects
|
||||
addGadget(new WinEffectPodium(this));
|
||||
addGadget(new WinEffectMrPunchMan(this));
|
||||
//addGadget(new WinEffectFireworks(this));
|
||||
addGadget(new WinEffectFlames(this));
|
||||
addGadget(new WinEffectSnowTrails(this));
|
||||
//addGadget(new WinEffectDragonRider(this));
|
||||
addGadget(new WinEffectBabyChicken(this));
|
||||
addGadget(new WinEffectLightningStrike(this));
|
||||
addGadget(new WinEffectRiseOfTheElderGuardian(this));
|
||||
addGadget(new WinEffectLavaTrap(this));
|
||||
|
||||
// Music
|
||||
addGadget(new MusicGadget(this, "13 Disc", new String[] {""}, -2, 2256, 178000));
|
||||
addGadget(new MusicGadget(this, "Cat Disc", new String[] {""}, -2, 2257, 185000));
|
||||
addGadget(new MusicGadget(this, "Blocks Disc", new String[] {""}, -2, 2258, 345000));
|
||||
addGadget(new MusicGadget(this, "Chirp Disc", new String[] {""}, -2, 2259, 185000));
|
||||
addGadget(new MusicGadget(this, "Far Disc", new String[] {""}, -2, 2260, 174000));
|
||||
addGadget(new MusicGadget(this, "Mall Disc", new String[] {""}, -2, 2261, 197000));
|
||||
addGadget(new MusicGadget(this, "Mellohi Disc", new String[] {""}, -2, 2262, 96000));
|
||||
addGadget(new MusicGadget(this, "Stal Disc", new String[] {""}, -2, 2263, 150000));
|
||||
addGadget(new MusicGadget(this, "Strad Disc", new String[] {""}, -2, 2264, 188000));
|
||||
addGadget(new MusicGadget(this, "Ward Disc", new String[] {""}, -2, 2265, 251000));
|
||||
addGadget(new MusicGadget(this, "Wait Disc", new String[] {""}, -2, 2267, 238000));
|
||||
addGadget(new MusicGadget(this, "13 Disc", new String[] {""}, -2, 2256, 178000));
|
||||
addGadget(new MusicGadget(this, "Cat Disc", new String[] {""}, -2, 2257, 185000));
|
||||
addGadget(new MusicGadget(this, "Blocks Disc", new String[] {""}, -2, 2258, 345000));
|
||||
addGadget(new MusicGadget(this, "Chirp Disc", new String[] {""}, -2, 2259, 185000));
|
||||
addGadget(new MusicGadget(this, "Far Disc", new String[] {""}, -2, 2260, 174000));
|
||||
addGadget(new MusicGadget(this, "Mall Disc", new String[] {""}, -2, 2261, 197000));
|
||||
addGadget(new MusicGadget(this, "Mellohi Disc", new String[] {""}, -2, 2262, 96000));
|
||||
addGadget(new MusicGadget(this, "Stal Disc", new String[] {""}, -2, 2263, 150000));
|
||||
addGadget(new MusicGadget(this, "Strad Disc", new String[] {""}, -2, 2264, 188000));
|
||||
addGadget(new MusicGadget(this, "Ward Disc", new String[] {""}, -2, 2265, 251000));
|
||||
addGadget(new MusicGadget(this, "Wait Disc", new String[] {""}, -2, 2267, 238000));
|
||||
|
||||
|
||||
// Game Modifiers
|
||||
|
||||
// MineStrike
|
||||
addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.P250_Muertos, -2));
|
||||
addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.CZ75_Auto_Tigris, -2));
|
||||
addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.Desert_Eagle_Blaze, -2));
|
||||
addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.Nova_Koi, -2));
|
||||
addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.XM1014_Tranquility, -2));
|
||||
addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.PP_Bizon_Streak, -2));
|
||||
addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.P90_Asiimov, -2));
|
||||
addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.SSG_08_Blood_in_the_Water, -2));
|
||||
addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.AWP_Asiimov, -2));
|
||||
|
||||
addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.Knife_M9_Bayonette_Fade, -2));
|
||||
|
||||
//Blue only
|
||||
addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.P2000_Fire_Elemental, -2));
|
||||
addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.FAMAS_Pulse, -2));
|
||||
addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.M4A4_Howl, -2));
|
||||
addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.Steyr_AUG_Torque, -2));
|
||||
//Red only
|
||||
addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.Glock_18_Fade, -2));
|
||||
addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.Galil_AR_Eco, -2));
|
||||
addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.AK_47_Vulcan, -2));
|
||||
addGadget(new GameModifierMineStrikeSkin(this, MineStrikeSkin.SG553_Pulse, -2));
|
||||
|
||||
|
||||
// Survival Games
|
||||
// Also not being released in this update
|
||||
// Beastmaster
|
||||
//addGadget(new ChickenKitGameModifier(this));
|
||||
//addGadget(new MiniGuardianKitGameModifier(this));
|
||||
//addGadget(new PigKitGameModifier(this));
|
||||
//addGadget(new SquidKitGameModifier(this));
|
||||
|
||||
// Horseman
|
||||
//addGadget(new MuleKitGameModifier(this));
|
||||
//addGadget(new SkeletonHorseKitGameModifier(this));
|
||||
|
||||
// Necromancer
|
||||
//addGadget(new WitherSkeletonKitGameModifier(this));
|
||||
|
||||
|
||||
// Bridges
|
||||
//addGadget(new PotatoKitGameModifier(this));
|
||||
|
||||
for(GadgetType type : GadgetType.values())
|
||||
{
|
||||
if(!_gadgets.containsKey(type))
|
||||
{
|
||||
_gadgets.put(type, new ArrayList<Gadget>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Gadget getGadget(Class<? extends Gadget> c)
|
||||
public <T extends Gadget> T getGadget(Class<T> c)
|
||||
{
|
||||
for(GadgetType type : GadgetType.values())
|
||||
{
|
||||
for(Gadget gadget : getGadgets(type))
|
||||
{
|
||||
if(gadget.getClass().equals(c)) return gadget;
|
||||
if(gadget.getClass().equals(c)) return (T) gadget;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@ -360,6 +562,69 @@ public class GadgetManager extends MiniPlugin
|
||||
return _gadgets.get(gadgetType);
|
||||
}
|
||||
|
||||
public List<GadgetGameModifier> getGameModifiers(GameModifierType gameType)
|
||||
{
|
||||
List<GadgetGameModifier> list = new ArrayList<>();
|
||||
for (Gadget g : getGadgets(GadgetType.GameModifier))
|
||||
{
|
||||
if (g instanceof GadgetGameModifier)
|
||||
{
|
||||
GadgetGameModifier mod = (GadgetGameModifier) g;
|
||||
if (mod.getGameType() == gameType) list.add(mod);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public GameModifierMineStrikeSkin getGameModifier(MineStrikeSkin skin)
|
||||
{
|
||||
for(GadgetGameModifier g : getGameModifiers(GameModifierType.MineStrike))
|
||||
{
|
||||
GameModifierMineStrikeSkin gskin = (GameModifierMineStrikeSkin) g;
|
||||
if(g.GetName().equals(skin.getSkinName())) return gskin;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<GadgetGameModifier> getGameModifiers(KitModifierType kitType)
|
||||
{
|
||||
List<GadgetGameModifier> list = new ArrayList<>();
|
||||
for (GadgetGameModifier gadget : getGameModifiers(kitType.getGameModifierType()))
|
||||
{
|
||||
if (gadget instanceof KitGameModifier)
|
||||
{
|
||||
if (((KitGameModifier) gadget).getKitType() == kitType)
|
||||
{
|
||||
list.add(gadget);
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public GadgetGameModifier getActiveGameModifier(Player player, GameModifierType gameType, Predicate<GadgetGameModifier> selector)
|
||||
{
|
||||
for (GadgetGameModifier g : getGameModifiers(gameType))
|
||||
{
|
||||
if (!g.IsActive(player)) { continue; }
|
||||
if (!selector.test(g)) { continue; }
|
||||
return g;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Gets all the Game modifiers that are related to kits
|
||||
public KitGameModifier getActiveGameModifier(Player player, KitModifierType kitType, Predicate<GadgetGameModifier> selector)
|
||||
{
|
||||
for (GadgetGameModifier g : getGameModifiers(kitType))
|
||||
{
|
||||
if (!g.IsActive(player)) { continue; }
|
||||
if (!selector.test(g)) { continue; }
|
||||
if (!(g instanceof KitGameModifier)) { continue; }
|
||||
return (KitGameModifier) g;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Disallows two armor gadgets in same slot.
|
||||
public void RemoveOutfit(Player player, ArmorSlot slot)
|
||||
@ -409,6 +674,12 @@ public class GadgetManager extends MiniPlugin
|
||||
if (gadget instanceof DeathEffectGadget)
|
||||
continue;
|
||||
|
||||
if (gadget instanceof WinEffectGadget)
|
||||
continue;
|
||||
|
||||
if(gadget instanceof GadgetGameModifier)
|
||||
continue;
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
gadget.Disable(player);
|
||||
}
|
||||
@ -470,11 +741,26 @@ public class GadgetManager extends MiniPlugin
|
||||
return _disguiseManager;
|
||||
}
|
||||
|
||||
public HologramManager getHologramManager()
|
||||
{
|
||||
return _hologramManager;
|
||||
}
|
||||
|
||||
public InventoryManager getInventoryManager()
|
||||
{
|
||||
return _inventoryManager;
|
||||
}
|
||||
|
||||
public OutfitWindUpSuitBoosterManager getBoosterManager()
|
||||
{
|
||||
return _boosterManager;
|
||||
}
|
||||
|
||||
public MountManager getMountManager()
|
||||
{
|
||||
return _mountManager;
|
||||
}
|
||||
|
||||
public boolean collideEvent(Player shooter, Gadget gadget, Player other)
|
||||
{
|
||||
GadgetCollideEntityEvent collideEvent = new GadgetCollideEntityEvent(shooter, gadget, other);
|
||||
@ -527,8 +813,6 @@ public class GadgetManager extends MiniPlugin
|
||||
public void death(PlayerDeathEvent event)
|
||||
{
|
||||
_lastMove.remove(event.getEntity());
|
||||
|
||||
_playerActiveGadgetMap.remove(event.getEntity());
|
||||
}
|
||||
|
||||
public void setActive(Player player, Gadget gadget)
|
||||
|
@ -0,0 +1,121 @@
|
||||
package mineplex.core.gadget.commands;
|
||||
|
||||
import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class AmmoCommand extends CommandBase<GadgetManager>
|
||||
{
|
||||
|
||||
private GadgetManager _plugin;
|
||||
|
||||
public AmmoCommand(GadgetManager plugin)
|
||||
{
|
||||
super(plugin, Rank.JNR_DEV, "ammo");
|
||||
_plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
boolean testServer = _plugin.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing");
|
||||
|
||||
if(!testServer)
|
||||
{
|
||||
UtilPlayer.message(caller, F.elem("This command can only be used on test servers!"));
|
||||
}
|
||||
|
||||
if(args.length == 2)
|
||||
{
|
||||
String gadgetName = args[0];
|
||||
String amount = args[1];
|
||||
Gadget gadget = getGadgetByName(gadgetName);
|
||||
if (gadget == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Ammo", "Could not find gadget " + F.skill(gadgetName)));
|
||||
}
|
||||
else
|
||||
{
|
||||
addAmmo(caller, caller, gadget, amount);
|
||||
}
|
||||
}
|
||||
else if (args.length == 3)
|
||||
{
|
||||
String gadgetName = args[0];
|
||||
String amount = args[1];
|
||||
String targetName = args[2];
|
||||
Player target = UtilPlayer.searchExact(targetName);
|
||||
|
||||
Gadget gadget = getGadgetByName(gadgetName);
|
||||
if (gadget == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Ammo", "Could not find gadget " + F.skill(gadgetName)));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (target == null)
|
||||
{
|
||||
_plugin.getClientManager().loadClientByName(targetName, new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
CoreClient client = _plugin.getClientManager().Get(targetName);
|
||||
|
||||
if (client != null)
|
||||
{
|
||||
addAmmo(caller, client.GetPlayer(), gadget, amount);
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Ammo", "Could not find player " + F.name(targetName)));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
addAmmo(caller, target, gadget, amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Ammo", "Usage: /ammo <gadget> <ammo> [player]"));
|
||||
}
|
||||
}
|
||||
|
||||
private void addAmmo(Player caller, Player target, Gadget gadget, String amount)
|
||||
{
|
||||
try
|
||||
{
|
||||
int ammo = Integer.parseInt(amount);
|
||||
_plugin.getInventoryManager().addItemToInventory(target, gadget.GetName(), ammo);
|
||||
UtilPlayer.message(caller, F.main("Ammo", "You gave " + F.elem(ammo + " Ammo") + " for the gadget " + F.skill(gadget.GetName()) + " to " + F.name(target.getName()) + "."));
|
||||
if (target != null)
|
||||
{
|
||||
UtilPlayer.message(target, F.main("Ammo", F.name(caller.getName()) + " gave you " + F.elem(ammo + " Ammo") + " for the gadget " + F.skill(gadget.GetName()) + "."));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Ammo", "Invalid Ammo Amount"));
|
||||
}
|
||||
}
|
||||
|
||||
private Gadget getGadgetByName(String gadgetName)
|
||||
{
|
||||
for (Gadget gadget : _plugin.getGadgets(GadgetType.Item))
|
||||
{
|
||||
if (gadget.GetName().equalsIgnoreCase(gadgetName.replaceAll("_", " ")))
|
||||
return gadget;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
package mineplex.core.gadget.commands;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class UnlockCosmeticsCommand extends CommandBase<GadgetManager>
|
||||
{
|
||||
|
||||
private GadgetManager _plugin;
|
||||
|
||||
public UnlockCosmeticsCommand(GadgetManager plugin)
|
||||
{
|
||||
super(plugin, Rank.JNR_DEV, "unlockCosmetics");
|
||||
_plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
boolean testServer = _plugin.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing");
|
||||
|
||||
if(!testServer)
|
||||
{
|
||||
UtilPlayer.message(caller, F.elem("This command can only be used on test servers!"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Adds all cosmetic types
|
||||
if (args.length == 0)
|
||||
{
|
||||
addCosmetics(null, caller);
|
||||
}
|
||||
// Adds specific type
|
||||
else
|
||||
{
|
||||
String type = args[0];
|
||||
if (type.equalsIgnoreCase("all"))
|
||||
{
|
||||
addCosmetics(null, caller);
|
||||
}
|
||||
else
|
||||
{
|
||||
GadgetType gadgetType = GadgetType.valueOf(type);
|
||||
if (gadgetType == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Cosmetics", "Invalid cosmetic type!"));
|
||||
}
|
||||
else
|
||||
{
|
||||
addCosmetics(gadgetType, caller);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void addCosmetics(GadgetType gadgetType, Player caller)
|
||||
{
|
||||
if (gadgetType == null)
|
||||
{
|
||||
for (GadgetType type : GadgetType.values())
|
||||
{
|
||||
addCosmetics(type, caller);
|
||||
}
|
||||
return;
|
||||
}
|
||||
for (Gadget gadget : _plugin.getGadgets(gadgetType))
|
||||
{
|
||||
_plugin.getDonationManager().Get(caller.getName()).AddUnknownSalesPackagesOwned(gadget.GetName());
|
||||
}
|
||||
UtilPlayer.message(caller, F.main("Cosmetics", "Added all the " + gadgetType.name() + " cosmetics!"));
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
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 ArrowTrailBlood extends ArrowEffectGadget
|
||||
{
|
||||
|
||||
public ArrowTrailBlood(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Bloody Arrows",
|
||||
UtilText.splitLineToArray(C.cGray + "Arrows soaked in blood. No effect, but your enemies may fear getting icky right before dying.", LineFormat.LORE),
|
||||
-2, Material.REDSTONE, (byte) 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doTrail(Arrow arrow)
|
||||
{
|
||||
UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, arrow.getLocation(), null, 0f, 1, ViewDist.LONG);
|
||||
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.REDSTONE_BLOCK, 0), arrow.getLocation(), null, 0.05f, 3, ViewDist.LONG);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doHitEffect(Arrow arrow)
|
||||
{
|
||||
UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, arrow.getLocation(), 0.4f, 0.4f, 0.4f, 0f, 20, ViewDist.LONG);
|
||||
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.REDSTONE_BLOCK, 0), arrow.getLocation(), 0.1f, 0.1f, 0.1f, 0.25f, 60, ViewDist.LONG);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -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 + "This " + C.cPurple + "party train" + C.cGray + " won't stop till the arrow hits your face.", LineFormat.LORE),
|
||||
-2, 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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -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("That’s the power of love!", LineFormat.LORE),
|
||||
-2, 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);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package mineplex.core.gadget.gadgets.arrowtrail;
|
||||
|
||||
import mineplex.core.common.util.*;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
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 ArrowTrailEmerald extends ArrowEffectGadget
|
||||
{
|
||||
|
||||
public ArrowTrailEmerald(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Green Arrows",
|
||||
UtilText.splitLineToArray(C.cGreen + "The arrows of a hero long past. Some say he hung out with bats and canaries.", LineFormat.LORE),
|
||||
-2, Material.EMERALD, (byte)0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doTrail(Arrow arrow)
|
||||
{
|
||||
Vector v = arrow.getVelocity();
|
||||
Vector up = UtilAlg.getUp(v);
|
||||
Vector left = UtilAlg.getLeft(v);
|
||||
|
||||
Location loc = arrow.getLocation();
|
||||
|
||||
double amount = 2;
|
||||
double ticks = 15;
|
||||
for(int i = 0; i < amount; i++)
|
||||
{
|
||||
double rad = Math.PI*2.0;
|
||||
rad += i/amount * rad;
|
||||
rad += Math.PI*2*(arrow.getTicksLived()%ticks)/ticks;
|
||||
double l = -Math.sin(rad);
|
||||
double u = Math.cos(rad);
|
||||
|
||||
Vector vel = v.clone().add(up.clone().multiply(u)).add(left.clone().multiply(l));
|
||||
vel.multiply(0.4);
|
||||
|
||||
UtilParticle.PlayParticleToAll(ParticleType.HAPPY_VILLAGER, loc.clone().add(vel), vel, 1f, 0, ViewDist.LONGER);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doHitEffect(Arrow arrow)
|
||||
{
|
||||
UtilParticle.PlayParticleToAll(ParticleType.HAPPY_VILLAGER, arrow.getLocation(), 0.35f, 0.35f, 0.35f, 1f, 15, ViewDist.LONGER);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
package mineplex.core.gadget.gadgets.arrowtrail;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Arrow;
|
||||
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.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;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class ArrowTrailEnchant extends ArrowEffectGadget
|
||||
{
|
||||
|
||||
private Map<Arrow, Long> _arrowMap = new HashMap<>();
|
||||
|
||||
public ArrowTrailEnchant(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Smart Arrows",
|
||||
UtilText.splitLineToArray(C.cGray + "Ancient runes speed these arrows along their path.", LineFormat.LORE),
|
||||
-2, Material.BOOK, (byte) 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doTrail(Arrow arrow)
|
||||
{
|
||||
Vector v = arrow.getVelocity();
|
||||
double l = v.lengthSquared();
|
||||
v.multiply(-1/l);
|
||||
for(int i = 0; i < l; i++) {
|
||||
UtilParticle.PlayParticleToAll(ParticleType.ENCHANTMENT_TABLE, arrow.getLocation().add(v.clone().multiply(i+1)), null, 1, 0, ViewDist.LONG);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doHitEffect(Arrow arrow)
|
||||
{
|
||||
_arrowMap.put(arrow, System.currentTimeMillis() + 2000);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onUpdate(UpdateEvent event)
|
||||
{
|
||||
if(event.getType() != UpdateType.TICK) return;
|
||||
|
||||
for (Iterator<Entry<Arrow, Long>> it = _arrowMap.entrySet().iterator(); it.hasNext();)
|
||||
{
|
||||
Entry<Arrow, Long> e = it.next();
|
||||
if(e.getValue() <= System.currentTimeMillis())
|
||||
{
|
||||
it.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
Location loc = e.getKey().getLocation().add(0, 1, 0);
|
||||
for(double d = 0; d < Math.PI*2; d += Math.PI/6) {
|
||||
double x = Math.sin(d);
|
||||
double z = Math.cos(d);
|
||||
Vector v = new Vector(x, -0.6, z).multiply(1.5);
|
||||
// OUT
|
||||
// UtilParticle.PlayParticleToAll(ParticleType.ENCHANTMENT_TABLE, loc.clone().add(-x*1.5, 0, -z*1.5), v, 1, 0, ViewDist.LONG);
|
||||
// IN
|
||||
UtilParticle.PlayParticleToAll(ParticleType.ENCHANTMENT_TABLE, loc.clone(), v, 1, 0, ViewDist.LONG);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
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 ArrowTrailMusic extends ArrowEffectGadget
|
||||
{
|
||||
|
||||
public ArrowTrailMusic(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Music Arrows",
|
||||
UtilText.splitLineToArray(C.cGray + C.Italics + "\u266B Music is the salve that heals the weary soul. Unlike these. These kill people. \u266B", LineFormat.LORE),
|
||||
-2, Material.GREEN_RECORD, (byte) 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doTrail(Arrow arrow)
|
||||
{
|
||||
|
||||
float d = arrow.getTicksLived()%25;
|
||||
d /= 24f;
|
||||
|
||||
UtilParticle.PlayParticleToAll(ParticleType.NOTE, arrow.getLocation(), d, 0, 0, 1, 0, ViewDist.LONGER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doHitEffect(Arrow arrow)
|
||||
{
|
||||
UtilParticle.PlayParticleToAll(ParticleType.NOTE, arrow.getLocation(), 0.5f, 0.3f, 0.5f, 1, 5, ViewDist.LONGER);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package mineplex.core.gadget.gadgets.arrowtrail;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
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 ArrowTrailShadow extends ArrowEffectGadget
|
||||
{
|
||||
|
||||
public ArrowTrailShadow(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Shadow Arrows",
|
||||
UtilText.splitLineToArray(C.cGray + C.Italics + "\"What's blacker than black? None more black.\"", LineFormat.LORE),
|
||||
-2, Material.COAL, (byte) 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doTrail(Arrow arrow)
|
||||
{
|
||||
// if(!(arrow.getShooter() instanceof Player)) return;
|
||||
// Player player = (Player) arrow.getShooter();
|
||||
// if(getSet() == null || !getSet().isActive(player)) return;
|
||||
UtilParticle.PlayParticleToAll(ParticleType.SMOKE, arrow.getLocation(), null, 0.1f, 3, ViewDist.LONG);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doHitEffect(Arrow arrow)
|
||||
{
|
||||
UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, arrow.getLocation(), 0.3f, 0.3f, 0.3f , 0, 5, ViewDist.LONG);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
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 ArrowTrailStorm extends ArrowEffectGadget
|
||||
{
|
||||
|
||||
public ArrowTrailStorm(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Rain Arrows",
|
||||
UtilText.splitLineToArray(C.cGray + "Arrows that bless the rain down in Africa.", LineFormat.LORE),
|
||||
-2, Material.INK_SACK, (byte) 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doTrail(Arrow arrow)
|
||||
{
|
||||
UtilParticle.PlayParticleToAll(ParticleType.SPLASH, arrow.getLocation(), 0.0f, 0.0f, 0.0f, 0.3f, 10, ViewDist.LONGER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doHitEffect(Arrow arrow)
|
||||
{
|
||||
UtilParticle.PlayParticleToAll(ParticleType.SPLASH, arrow.getLocation(), 0.4f, 0.4f, 0.4f, 0.7f, 160, ViewDist.LONGER);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
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.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.GadgetManager;
|
||||
import mineplex.core.gadget.types.DeathEffectGadget;
|
||||
|
||||
public class DeathBlood extends DeathEffectGadget
|
||||
{
|
||||
|
||||
public DeathBlood(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Gory Blood Death",
|
||||
UtilText.splitLineToArray(C.cGray + "A gruesome display fit for Kill Bill.", LineFormat.LORE),
|
||||
-2, Material.REDSTONE, (byte) 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlood(Player player, BloodEvent event)
|
||||
{
|
||||
event.setItem(Material.REDSTONE_BLOCK, (byte) 0);
|
||||
UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, player.getLocation(), 0.4f, 0.4f, 0.4f, 0f, 20, ViewDist.LONG);
|
||||
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.REDSTONE_BLOCK, 0), player.getLocation(), 0.1f, 0.1f, 0.1f, 0.25f, 60, ViewDist.LONG);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -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.INK_SACK, (byte)1);
|
||||
}
|
||||
|
||||
@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);
|
||||
|
@ -0,0 +1,35 @@
|
||||
package mineplex.core.gadget.gadgets.death;
|
||||
|
||||
import org.bukkit.Location;
|
||||
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 DeathCupidsBrokenHeart extends DeathEffectGadget
|
||||
{
|
||||
|
||||
public DeathCupidsBrokenHeart(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Cupid's Broken Heart",
|
||||
UtilText.splitLineToArray("Cue the weeping violins...", LineFormat.LORE),
|
||||
-2, Material.APPLE, (byte) 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlood(Player player, BloodEvent event)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
Location loc = player.getLocation().add(0, 0.9, 0);
|
||||
|
||||
UtilParticle.PlayParticleToAll(ParticleType.HEART, loc, 0.3f, 0.7f, 0.3f, 0, 15, ViewDist.NORMAL);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
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.C;
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.types.DeathEffectGadget;
|
||||
|
||||
public class DeathEmerald extends DeathEffectGadget
|
||||
{
|
||||
|
||||
public DeathEmerald(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Green Death",
|
||||
UtilText.splitLineToArray(C.cGreen + "Watch your power fade into an emerald mist.", LineFormat.LORE),
|
||||
-2, Material.EMERALD, (byte) 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlood(Player player, BloodEvent event)
|
||||
{
|
||||
event.setItem(Material.EMERALD, (byte) 0);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package mineplex.core.gadget.gadgets.death;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
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.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.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;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class DeathEnchant extends DeathEffectGadget
|
||||
{
|
||||
|
||||
private Map<Location, Long> _locationMap = new HashMap<>();
|
||||
|
||||
public DeathEnchant(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Death of Wisdom",
|
||||
UtilText.splitLineToArray(C.cGray + "You know what’s more valuable than winning? KNOWLEDGE", LineFormat.LORE),
|
||||
-2, Material.BOOK, (byte) 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlood(Player player, BloodEvent event)
|
||||
{
|
||||
event.setItem(Material.BOOK, (byte)0);
|
||||
_locationMap.put(event.getLocation().clone(), System.currentTimeMillis() + 1500);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onUpdate(UpdateEvent event)
|
||||
{
|
||||
if(event.getType() != UpdateType.TICK) return;
|
||||
|
||||
for (Iterator<Entry<Location, Long>> it = _locationMap.entrySet().iterator(); it.hasNext();)
|
||||
{
|
||||
Entry<Location, Long> e = it.next();
|
||||
if(e.getValue() <= System.currentTimeMillis())
|
||||
{
|
||||
it.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
Location loc = e.getKey().clone().add(0, 1, 0);
|
||||
for(double d = 0; d < Math.PI*2; d += Math.PI/6) {
|
||||
double x = Math.sin(d);
|
||||
double z = Math.cos(d);
|
||||
Vector v = new Vector(x, -0.6, z).multiply(1.5);
|
||||
// OUT
|
||||
UtilParticle.PlayParticleToAll(ParticleType.ENCHANTMENT_TABLE, loc.clone().add(-x*1.5, 0, -z*1.5), v, 1, 0, ViewDist.LONG);
|
||||
// IN
|
||||
// UtilParticle.PlayParticleToAll(ParticleType.ENCHANTMENT_TABLE, loc.clone(), v, 1, 0, ViewDist.LONG);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,8 @@
|
||||
package mineplex.core.gadget.gadgets.death;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.blood.BloodEvent;
|
||||
import mineplex.core.common.util.C;
|
||||
@ -26,28 +24,17 @@ public class DeathHearts extends DeathEffectGadget
|
||||
public DeathHearts(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Broken Hearted",
|
||||
UtilText.splitLineToArray(C.cGray + "Nothing hurts more than having your heart broken. Apart from being killed, that is.", LineFormat.LORE),
|
||||
-6, Material.APPLE, (byte) 0);
|
||||
UtilText.splitLineToArray(C.cGray + "Nothing hurts more than having your heart broken. Apart from being killed, that is.",
|
||||
LineFormat.LORE),
|
||||
-6, Material.APPLE, (byte) 0);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlood(BloodEvent event)
|
||||
@Override
|
||||
public void onBlood(Player player, BloodEvent event)
|
||||
{
|
||||
if (IsActive(event.getPlayer()))
|
||||
event.setItem(Material.AIR, (byte) 0);
|
||||
}
|
||||
event.setCancelled(true);
|
||||
Location loc = event.getLocation().clone().add(0, .5, 0);
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onParticles(BloodEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
if (IsActive(event.getPlayer()))
|
||||
{
|
||||
Location loc = event.getLocation().clone().add(0, .5, 0);
|
||||
|
||||
UtilParticle.PlayParticleToAll(ParticleType.HEART, loc, 0F, 0F, 0F, 0F, 1, ViewDist.NORMAL);
|
||||
}
|
||||
UtilParticle.PlayParticleToAll(ParticleType.HEART, loc, 0F, 0F, 0F, 0F, 1, ViewDist.NORMAL);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,90 @@
|
||||
package mineplex.core.gadget.gadgets.death;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
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.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.GadgetManager;
|
||||
import mineplex.core.gadget.types.DeathEffectGadget;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class DeathMusic extends DeathEffectGadget
|
||||
{
|
||||
|
||||
private Map<Location, Long> _playerMap = new HashMap<>();
|
||||
|
||||
public DeathMusic(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Musical Death",
|
||||
UtilText.splitLineToArray(C.cGray + C.Italics + "\u266B Your very own swan song. \u266B", LineFormat.LORE),
|
||||
-2, Material.GREEN_RECORD, (byte) 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlood(Player player, BloodEvent event)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
_playerMap.put(player.getLocation(), System.currentTimeMillis() + 1250);
|
||||
_playerMap.put(player.getLocation().add(0, 0.9, 0), System.currentTimeMillis() + 1250);
|
||||
_playerMap.put(player.getLocation().add(0, 1.8, 0), System.currentTimeMillis() + 1250);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onUpdate(UpdateEvent event)
|
||||
{
|
||||
if(event.getType() != UpdateType.TICK) return;
|
||||
|
||||
if(event.getTick()%2 == 1) return;
|
||||
|
||||
for(Iterator<Entry<Location, Long>> it = _playerMap.entrySet().iterator(); it.hasNext();)
|
||||
{
|
||||
Entry<Location, Long> e = it.next();
|
||||
if(e.getValue() <= System.currentTimeMillis())
|
||||
{
|
||||
it.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
long diff = e.getValue()-System.currentTimeMillis();
|
||||
double d = diff/1250.0;
|
||||
|
||||
int amount = 4;
|
||||
|
||||
double rad = Math.PI * 2 * d;
|
||||
|
||||
|
||||
double step = Math.PI * 2;
|
||||
step /= amount;
|
||||
|
||||
for(int i = 0; i < amount; i++)
|
||||
{
|
||||
double rad2 = rad + step * i;
|
||||
|
||||
double x = Math.sin(rad2) * d * 1.3;
|
||||
double z = Math.cos(rad2) * d * 1.3;
|
||||
|
||||
Location loc = e.getKey().clone().add(x, 0, z);
|
||||
|
||||
UtilParticle.PlayParticleToAll(ParticleType.NOTE, loc, new Vector(d, 0, 0), 1, 0, ViewDist.NORMAL);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package mineplex.core.gadget.gadgets.death;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
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.UtilItem;
|
||||
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, "Pinata Burst",
|
||||
UtilText.splitLineToArray(C.cGray + "Kill 'em with kindness and " + C.cPurple + "candy!", LineFormat.LORE),
|
||||
-2, Material.FIREWORK, (byte)0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlood(Player player, BloodEvent event)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
for(byte d : _data)
|
||||
{
|
||||
ItemStack item = new ItemStack(Material.INK_SACK, 1, (short) 0, d);
|
||||
UtilItem.dropItem(item, event.getLocation(), true, false, 40, false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
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.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.GadgetManager;
|
||||
import mineplex.core.gadget.types.DeathEffectGadget;
|
||||
|
||||
public class DeathShadow extends DeathEffectGadget
|
||||
{
|
||||
|
||||
public DeathShadow(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Shadow Death",
|
||||
UtilText.splitLineToArray(C.cGray + "A poof of smoke, and you’re gone!", LineFormat.LORE),
|
||||
-2, Material.COAL, (byte) 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlood(Player player, BloodEvent event)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
|
||||
UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, player.getLocation().add(0, 0.5, 0), 0.1f, 0.5f, 0.1f, 0, 50, ViewDist.NORMAL);
|
||||
UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, player.getLocation(), 0.5f, 0.0f, 0.5f, 0, 50, ViewDist.NORMAL);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
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.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.GadgetManager;
|
||||
import mineplex.core.gadget.types.DeathEffectGadget;
|
||||
|
||||
public class DeathStorm extends DeathEffectGadget
|
||||
{
|
||||
|
||||
public DeathStorm(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Gloomy Death",
|
||||
UtilText.splitLineToArray(C.cGray + "Drown in a puddle of your own tears.", LineFormat.LORE),
|
||||
-2, Material.INK_SACK, (byte) 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlood(Player player, BloodEvent event)
|
||||
{
|
||||
event.setItem(Material.INK_SACK, (byte) 4);
|
||||
UtilParticle.PlayParticleToAll(ParticleType.SPLASH, player.getLocation().add(0, 0.9, 0), 0.6f, 0.9f, 0.6f, 0.6f, 100, ViewDist.NORMAL);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,32 @@
|
||||
package mineplex.core.gadget.gadgets.doublejump;
|
||||
|
||||
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.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.DoubleJumpEffectGadget;
|
||||
|
||||
public class DoubleJumpBlood extends DoubleJumpEffectGadget
|
||||
{
|
||||
|
||||
public DoubleJumpBlood(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Bloody Leap",
|
||||
UtilText.splitLineToArray(C.cGray + "Their blood gives you power, the power to soar!", LineFormat.LORE),
|
||||
-2, Material.REDSTONE, (byte) 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doEffect(Player player)
|
||||
{
|
||||
UtilParticle.PlayParticleToAll(ParticleType.RED_DUST, player.getLocation(), 0.5f, 0.5f, 0.5f, 0f, 40, ViewDist.LONG);
|
||||
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.REDSTONE_BLOCK, 0), player.getLocation(), 0.1f, 0.1f, 0.1f, 0.25f, 100, ViewDist.LONG);
|
||||
}
|
||||
|
||||
}
|
@ -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("Take flight on the wings of love!", LineFormat.LORE),
|
||||
-2, 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);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
package mineplex.core.gadget.gadgets.doublejump;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
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.UtilAlg;
|
||||
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.DoubleJumpEffectGadget;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class DoubleJumpEmerald extends DoubleJumpEffectGadget
|
||||
{
|
||||
|
||||
private HashMap<Player, Long> _players = new HashMap<>();
|
||||
|
||||
public DoubleJumpEmerald(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Green Jump",
|
||||
UtilText.splitLineToArray(C.cGreen + "Harness the ancient emerald energy to leap through the air.", LineFormat.LORE),
|
||||
-2, Material.EMERALD, (byte)0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doEffect(Player player)
|
||||
{
|
||||
_players.put(player, System.currentTimeMillis() + 500);
|
||||
float r = 0.5f;
|
||||
UtilParticle.PlayParticleToAll(ParticleType.HAPPY_VILLAGER, player.getLocation(), r, r, r, 0, 20, ViewDist.LONGER);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onUpdate(UpdateEvent event)
|
||||
{
|
||||
if(event.getType() != UpdateType.TICK) return;
|
||||
|
||||
for (Iterator<Entry<Player, Long>> it = _players.entrySet().iterator(); it.hasNext();)
|
||||
{
|
||||
Entry<Player, Long> e = it.next();
|
||||
if(e.getValue() < System.currentTimeMillis())
|
||||
{
|
||||
it.remove();
|
||||
continue;
|
||||
}
|
||||
double diff = e.getValue()-System.currentTimeMillis();
|
||||
double r = (diff + 100)/400;
|
||||
|
||||
Vector v = e.getKey().getVelocity();
|
||||
Vector up = UtilAlg.getUp(v);
|
||||
Vector left = UtilAlg.getLeft(v);
|
||||
|
||||
Location loc = e.getKey().getLocation();
|
||||
|
||||
double amount = 3;
|
||||
double ticks = 15;
|
||||
for(int i = 0; i < amount; i++)
|
||||
{
|
||||
double rad = Math.PI*2.0;
|
||||
rad += i/amount * rad;
|
||||
rad += Math.PI*2*(e.getKey().getTicksLived()%ticks)/ticks;
|
||||
double l = -Math.sin(rad);
|
||||
double u = Math.cos(rad);
|
||||
|
||||
Vector vel = v.clone().add(up.clone().multiply(u)).add(left.clone().multiply(l));
|
||||
vel.multiply(r);
|
||||
|
||||
UtilParticle.PlayParticleToAll(ParticleType.HAPPY_VILLAGER, loc.clone().add(vel), vel, 1f, 0, ViewDist.LONGER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
package mineplex.core.gadget.gadgets.doublejump;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
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.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 DoubleJumpEnchant extends DoubleJumpEffectGadget
|
||||
{
|
||||
|
||||
private Map<Location, Long> _locationMap = new HashMap<>();
|
||||
private Map<Player, Long> _playerMap = new HashMap<>();
|
||||
|
||||
public DoubleJumpEnchant(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Leap of Wisdom",
|
||||
UtilText.splitLineToArray(C.cGray + "Distant sages use this leap to reach the highest shelves in their library.", LineFormat.LORE),
|
||||
-2, Material.BOOK, (byte) 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doEffect(Player player)
|
||||
{
|
||||
_locationMap.put(player.getLocation(), System.currentTimeMillis() + 1500);
|
||||
_playerMap.put(player, System.currentTimeMillis() + 1100);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onUpdate(UpdateEvent event)
|
||||
{
|
||||
if(event.getType() != UpdateType.TICK) return;
|
||||
|
||||
for (Iterator<Entry<Location, Long>> it = _locationMap.entrySet().iterator(); it.hasNext();)
|
||||
{
|
||||
Entry<Location, Long> e = it.next();
|
||||
if(e.getValue() <= System.currentTimeMillis())
|
||||
{
|
||||
it.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
Location loc = e.getKey().clone().add(0, 1, 0);
|
||||
for(double d = 0; d < Math.PI*2; d += Math.PI/6) {
|
||||
double x = Math.sin(d);
|
||||
double z = Math.cos(d);
|
||||
Vector v = new Vector(x, -0.6, z).multiply(1.5);
|
||||
// OUT
|
||||
// UtilParticle.PlayParticleToAll(ParticleType.ENCHANTMENT_TABLE, loc.clone().add(-x*1.5, 0, -z*1.5), v, 1, 0, ViewDist.LONG);
|
||||
// IN
|
||||
UtilParticle.PlayParticleToAll(ParticleType.ENCHANTMENT_TABLE, loc.clone(), v, 1, 0, ViewDist.LONG);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
long diff = e.getValue()-System.currentTimeMillis();
|
||||
float r = diff/2000.0f;
|
||||
UtilParticle.PlayParticleToAll(ParticleType.ENCHANTMENT_TABLE, e.getKey().getLocation(), r, r, r, 0, 10, ViewDist.LONGER);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package mineplex.core.gadget.gadgets.doublejump;
|
||||
|
||||
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.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.DoubleJumpEffectGadget;
|
||||
|
||||
public class DoubleJumpFirecracker extends DoubleJumpEffectGadget
|
||||
{
|
||||
|
||||
private byte[] _data = new byte[]{1,2,4,5,6,9,10,11,12,13,14,15};
|
||||
|
||||
public DoubleJumpFirecracker(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Firecracker Leap",
|
||||
UtilText.splitLineToArray(C.cGray + "Propel yourself in the air with the power of " + C.cPurple + "FREEDOM!", LineFormat.LORE),
|
||||
-2, Material.FIREWORK, (byte)0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doEffect(Player player)
|
||||
{
|
||||
for(byte data : _data) {
|
||||
String particle = ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, data);
|
||||
UtilParticle.PlayParticleToAll(particle, player.getLocation(), null, 0.3f, 15, ViewDist.LONGER);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
package mineplex.core.gadget.gadgets.doublejump;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
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.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 DoubleJumpMusic extends DoubleJumpEffectGadget
|
||||
{
|
||||
|
||||
private Map<Location, Long> _playerMap = new HashMap<>();
|
||||
|
||||
public DoubleJumpMusic(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Musical Leap",
|
||||
UtilText.splitLineToArray(C.cGray + C.Italics + "\u266B For when you’re just too groovy to stay on the ground. \u266B", LineFormat.LORE),
|
||||
-2, Material.GREEN_RECORD, (byte) 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doEffect(Player player)
|
||||
{
|
||||
_playerMap.put(player.getLocation(), System.currentTimeMillis() + 1250);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onUpdate(UpdateEvent event)
|
||||
{
|
||||
if(event.getType() != UpdateType.TICK) return;
|
||||
|
||||
if(event.getTick()%2 == 1) return;
|
||||
|
||||
for(Iterator<Entry<Location, Long>> it = _playerMap.entrySet().iterator(); it.hasNext();)
|
||||
{
|
||||
Entry<Location, Long> e = it.next();
|
||||
if(e.getValue() <= System.currentTimeMillis())
|
||||
{
|
||||
it.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
long diff = e.getValue()-System.currentTimeMillis();
|
||||
double d = 1 - diff/1250.0;
|
||||
|
||||
int amount = 4;
|
||||
|
||||
double rad = Math.PI * 2 * d;
|
||||
|
||||
|
||||
double step = Math.PI * 2;
|
||||
step /= amount;
|
||||
|
||||
for(int i = 0; i < amount; i++)
|
||||
{
|
||||
double rad2 = rad + step * i;
|
||||
|
||||
double x = Math.sin(rad2) * d * 1.3;
|
||||
double z = Math.cos(rad2) * d * 1.3;
|
||||
|
||||
Location loc = e.getKey().clone().add(x, 0, z);
|
||||
|
||||
UtilParticle.PlayParticleToAll(ParticleType.NOTE, loc, new Vector(d, 0, 0), 1, 0, ViewDist.NORMAL);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package mineplex.core.gadget.gadgets.doublejump;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
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.GadgetManager;
|
||||
import mineplex.core.gadget.types.DoubleJumpEffectGadget;
|
||||
|
||||
public class DoubleJumpShadow extends DoubleJumpEffectGadget
|
||||
{
|
||||
|
||||
public DoubleJumpShadow(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Shadow Leap",
|
||||
UtilText.splitLineToArray(C.cGray + "A shadowy leap preferred by master assassins.", LineFormat.LORE),
|
||||
-2, Material.COAL, (byte) 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doEffect(Player player)
|
||||
{
|
||||
UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, player.getLocation(), 0.5f, 0.0f, 0.5f, 0, 20, ViewDist.LONG);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package mineplex.core.gadget.gadgets.doublejump;
|
||||
|
||||
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.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.DoubleJumpEffectGadget;
|
||||
|
||||
public class DoubleJumpStorm extends DoubleJumpEffectGadget
|
||||
{
|
||||
|
||||
public DoubleJumpStorm(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Wet Leap",
|
||||
UtilText.splitLineToArray(C.cGray + "Time to get your feet wet.", LineFormat.LORE),
|
||||
-2, Material.INK_SACK, (byte) 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doEffect(Player player)
|
||||
{
|
||||
UtilParticle.PlayParticleToAll(ParticleType.SPLASH, player.getLocation(), 0.4f, 0.3f, 0.4f, 1f, 160, ViewDist.NORMAL);
|
||||
UtilParticle.PlayParticleToAll(ParticleType.CLOUD, player.getLocation(), 0.3f, 0.1f, 0.3f, 0.05f, 50, ViewDist.NORMAL);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package mineplex.core.gadget.gadgets.gamemodifiers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
|
||||
/**
|
||||
* The game modifier type. Normal a specific game.
|
||||
*/
|
||||
|
||||
public enum GameModifierType
|
||||
{
|
||||
|
||||
MineStrike("MineStrike", new String[]{"Apply custom gun models and skin to use ingame"}, Material.TNT, 0),
|
||||
SurvivalGames("Survival Games", new String[]{"Placeholder"}, Material.DIAMOND_SWORD, 0, true),
|
||||
Bridges("Bridges", new String[]{"Placeholder"}, Material.IRON_PICKAXE, 0, true);
|
||||
|
||||
private String _name;
|
||||
private List<String> _desc;
|
||||
private Material _mat;
|
||||
private int _data;
|
||||
private boolean _hasKits = false;
|
||||
|
||||
GameModifierType(String name, String[] desc, Material mat, int data, boolean hasKits)
|
||||
{
|
||||
this(name, desc, mat, data);
|
||||
_hasKits = hasKits;
|
||||
}
|
||||
|
||||
GameModifierType(String name, String[] desc, Material mat, int data)
|
||||
{
|
||||
_name = name;
|
||||
_mat = mat;
|
||||
|
||||
_desc = UtilText.splitLines(desc, LineFormat.LORE);
|
||||
for(int i = 0; i < _desc.size(); i++) if(!_desc.get(i).contains("§.")) _desc.set(i, C.cGray + _desc.get(i));
|
||||
|
||||
_data = data;
|
||||
}
|
||||
|
||||
public ItemStack getItemStack()
|
||||
{
|
||||
return ItemStackFactory.Instance.CreateStack(_mat, (byte) _data, 1, C.cGreen + C.Bold + _name, _desc);
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
public List<String> getDesc()
|
||||
{
|
||||
return _desc;
|
||||
}
|
||||
|
||||
public int getData()
|
||||
{
|
||||
return _data;
|
||||
}
|
||||
|
||||
public boolean hasKits()
|
||||
{
|
||||
return _hasKits;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package mineplex.core.gadget.gadgets.gamemodifiers.kits;
|
||||
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType;
|
||||
import mineplex.core.gadget.types.GadgetGameModifier;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
/**
|
||||
* This class creates a Kit modifier, to be implemented in game kits, such as Survival Games or Bridges
|
||||
*
|
||||
* @author LCastr0
|
||||
*/
|
||||
public class KitGameModifier extends GadgetGameModifier
|
||||
{
|
||||
|
||||
private KitModifierType _kitType;
|
||||
private String _kit;
|
||||
private String _id;
|
||||
|
||||
public KitGameModifier(GadgetManager manager, GameModifierType gameType, KitModifierType kitType, String name, String[] desc,
|
||||
int cost, Material material, byte data, String kit, String id)
|
||||
{
|
||||
super(manager, gameType, name, desc, cost, material, data);
|
||||
_kitType = kitType;
|
||||
_kit = kit;
|
||||
_id = id;
|
||||
}
|
||||
|
||||
public KitModifierType getKitType()
|
||||
{
|
||||
return _kitType;
|
||||
}
|
||||
|
||||
public String getKit()
|
||||
{
|
||||
return _kit;
|
||||
}
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void EnableCustom(Player player)
|
||||
{
|
||||
Manager.getGameModifiers(getGameType()).stream().filter(getKitFilter(_kit)).forEach(g -> g.Disable(player));
|
||||
|
||||
super.EnableCustom(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters kit based on name
|
||||
* @param kitName
|
||||
* @return
|
||||
*/
|
||||
public static Predicate<GadgetGameModifier> getKitFilter(String kitName)
|
||||
{
|
||||
return new Predicate<GadgetGameModifier>() {
|
||||
@Override
|
||||
public boolean test(GadgetGameModifier g) {
|
||||
if (!(g instanceof KitGameModifier)) { return false; }
|
||||
return ((KitGameModifier)g).getKit().equalsIgnoreCase(kitName);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package mineplex.core.gadget.gadgets.gamemodifiers.kits;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Lists types of KitGameModifier's
|
||||
*
|
||||
* @author LCastr0
|
||||
*/
|
||||
public enum KitModifierType
|
||||
{
|
||||
|
||||
Bridges_AppleKit(GameModifierType.Bridges, "Apple", new String[]{"Placeholder"}, Material.APPLE, (byte) 0),
|
||||
SurvivalGames_BeastmasterKit(GameModifierType.SurvivalGames, "Beastmaster", new String[]{"Placeholder"}, Material.BONE, (byte) 0),
|
||||
SurvivalGames_HorsemanKit(GameModifierType.SurvivalGames, "Horseman", new String[]{"Placeholder"}, Material.MONSTER_EGG, UtilEnt.getEntityEggData(EntityType.HORSE)),
|
||||
SurvivalGames_NecromancerKit(GameModifierType.SurvivalGames, "Necromancer", new String[]{"Placeholder"}, Material.SKULL_ITEM, (byte) 0);
|
||||
|
||||
private final GameModifierType _type;
|
||||
private final String _kitName;
|
||||
private final List<String> _desc;
|
||||
private final Material _mat;
|
||||
private final byte _data;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type
|
||||
* @param kitName
|
||||
* @param desc
|
||||
* @param mat
|
||||
* @param data
|
||||
*/
|
||||
KitModifierType(GameModifierType type, String kitName, String[] desc, Material mat, byte data)
|
||||
{
|
||||
_type = type;
|
||||
_kitName = kitName;
|
||||
_desc = UtilText.splitLines(desc, LineFormat.LORE);
|
||||
_mat = mat;
|
||||
_data = data;
|
||||
}
|
||||
|
||||
public GameModifierType getGameModifierType()
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
public String getKitName() {
|
||||
return _kitName;
|
||||
}
|
||||
|
||||
public List<String> getDescription()
|
||||
{
|
||||
return _desc;
|
||||
}
|
||||
|
||||
public ItemStack getItemStack()
|
||||
{
|
||||
return ItemStackFactory.Instance.CreateStack(_mat, _data, 1, C.cGreenB + _kitName, _desc);
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package mineplex.core.gadget.gadgets.gamemodifiers.kits.bridges;
|
||||
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
public class PotatoKitGameModifier extends KitGameModifier
|
||||
{
|
||||
|
||||
/**
|
||||
* Game: Bridges
|
||||
* Kit: Apple
|
||||
* Changes: Change Apples to Potatoes
|
||||
* @param manager
|
||||
*/
|
||||
|
||||
public PotatoKitGameModifier(GadgetManager manager)
|
||||
{
|
||||
super(manager, GameModifierType.Bridges, KitModifierType.Bridges_AppleKit, "Potatoes", new String[]{"Placeholder"}, 0, Material.POTATO_ITEM,
|
||||
(byte) 0, "Apple", "apple_potato");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package mineplex.core.gadget.gadgets.gamemodifiers.kits.survivalgames.beastmaster;
|
||||
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
public class ChickenKitGameModifier extends KitGameModifier
|
||||
{
|
||||
|
||||
/**
|
||||
* Game: Survival Games
|
||||
* Kit: Beastmaster
|
||||
* Changes: Change Wolves to Chickens
|
||||
* @param manager
|
||||
*/
|
||||
|
||||
public ChickenKitGameModifier(GadgetManager manager)
|
||||
{
|
||||
super(manager, GameModifierType.SurvivalGames, KitModifierType.SurvivalGames_BeastmasterKit, "Chicken", new String[]{"Placeholder"}, 0, Material.MONSTER_EGG,
|
||||
UtilEnt.getEntityEggData(EntityType.CHICKEN), "Beastmaster", "beastmaster_chicken");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package mineplex.core.gadget.gadgets.gamemodifiers.kits.survivalgames.beastmaster;
|
||||
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
public class MiniGuardianKitGameModifier extends KitGameModifier
|
||||
{
|
||||
|
||||
/**
|
||||
* Game: Survival Games
|
||||
* Kit: Beastmaster
|
||||
* Changes: Change Wolves to Mini Guardians
|
||||
* @param manager
|
||||
*/
|
||||
|
||||
public MiniGuardianKitGameModifier(GadgetManager manager)
|
||||
{
|
||||
super(manager, GameModifierType.SurvivalGames, KitModifierType.SurvivalGames_BeastmasterKit, "Mini Guardian", new String[]{"Placeholder"}, 0, Material.MONSTER_EGG,
|
||||
UtilEnt.getEntityEggData(EntityType.GUARDIAN), "Beastmaster", "beastmaster_mini_guardian");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package mineplex.core.gadget.gadgets.gamemodifiers.kits.survivalgames.beastmaster;
|
||||
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
public class PigKitGameModifier extends KitGameModifier
|
||||
{
|
||||
|
||||
/**
|
||||
* Game: Survival Games
|
||||
* Kit: Beastmaster
|
||||
* Changes: Change Wolves to Pigs
|
||||
* @param manager
|
||||
*/
|
||||
|
||||
public PigKitGameModifier(GadgetManager manager)
|
||||
{
|
||||
super(manager, GameModifierType.SurvivalGames, KitModifierType.SurvivalGames_BeastmasterKit, "Pig", new String[]{"Placeholder"}, 0, Material.MONSTER_EGG,
|
||||
UtilEnt.getEntityEggData(EntityType.PIG), "Beastmaster", "beastmaster_pig");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package mineplex.core.gadget.gadgets.gamemodifiers.kits.survivalgames.beastmaster;
|
||||
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
public class SquidKitGameModifier extends KitGameModifier
|
||||
{
|
||||
|
||||
/**
|
||||
* Game: Survival Games
|
||||
* Kit: Beastmaster
|
||||
* Changes: Change Wolves to Squids
|
||||
* @param manager
|
||||
*/
|
||||
|
||||
public SquidKitGameModifier(GadgetManager manager)
|
||||
{
|
||||
super(manager, GameModifierType.SurvivalGames, KitModifierType.SurvivalGames_BeastmasterKit, "Squid", new String[]{"Placeholder"}, 0, Material.MONSTER_EGG,
|
||||
UtilEnt.getEntityEggData(EntityType.SQUID), "Beastmaster", "beastmaster_squid");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package mineplex.core.gadget.gadgets.gamemodifiers.kits.survivalgames.horseman;
|
||||
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
public class MuleKitGameModifier extends KitGameModifier
|
||||
{
|
||||
|
||||
/**
|
||||
* Game: Survival Games
|
||||
* Kit: Horseman
|
||||
* Changes: Change Horses to Mules
|
||||
* @param manager
|
||||
*/
|
||||
|
||||
public MuleKitGameModifier(GadgetManager manager)
|
||||
{
|
||||
super(manager, GameModifierType.SurvivalGames, KitModifierType.SurvivalGames_HorsemanKit, "Mule", new String[]{"Placeholder"}, 0, Material.CHEST,
|
||||
(byte) 0, "Horseman", "horseman_mule");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package mineplex.core.gadget.gadgets.gamemodifiers.kits.survivalgames.horseman;
|
||||
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
public class SkeletonHorseKitGameModifier extends KitGameModifier
|
||||
{
|
||||
|
||||
/**
|
||||
* Game: Survival Games
|
||||
* Kit: Horseman
|
||||
* Changes: Change Horses to Skeleton Horses
|
||||
* @param manager
|
||||
*/
|
||||
|
||||
public SkeletonHorseKitGameModifier(GadgetManager manager)
|
||||
{
|
||||
super(manager, GameModifierType.SurvivalGames, KitModifierType.SurvivalGames_HorsemanKit, "Skeleton Horse", new String[]{"Placeholder"}, 0, Material.BONE,
|
||||
(byte) 0, "Horseman", "horseman_skeleton_horse");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package mineplex.core.gadget.gadgets.gamemodifiers.kits.survivalgames.necromancer;
|
||||
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
public class WitherSkeletonKitGameModifier extends KitGameModifier
|
||||
{
|
||||
|
||||
/**
|
||||
* Game: Survival Games
|
||||
* Kit: Necromancer
|
||||
* Changes: Change Skeletons to Wither Skeletons
|
||||
* @param manager
|
||||
*/
|
||||
|
||||
public WitherSkeletonKitGameModifier(GadgetManager manager)
|
||||
{
|
||||
super(manager, GameModifierType.SurvivalGames, KitModifierType.SurvivalGames_NecromancerKit, "Wither Skeleton", new String[]{"Placeholder"}, 0, Material.SKULL_ITEM,
|
||||
(byte) 1, "Necromancer", "necromancer_wither_skeleton");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,104 @@
|
||||
package mineplex.core.gadget.gadgets.gamemodifiers.minestrike;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType;
|
||||
import mineplex.core.gadget.types.GadgetGameModifier;
|
||||
|
||||
/**
|
||||
* A gamemodifier to apply custom skin data to {@link GameModifierType#MineStrike} weapons
|
||||
*/
|
||||
|
||||
public class GameModifierMineStrikeSkin extends GadgetGameModifier
|
||||
{
|
||||
|
||||
private String _weapon;
|
||||
private Material _skinMat;
|
||||
private byte _skinData;
|
||||
|
||||
/**
|
||||
* @param manager Normal gadget manager
|
||||
* @param name Display name of skin
|
||||
* @param lore Lore description of skin
|
||||
* @param weaponName The exact name of the weapon which this skin will replace
|
||||
* @param newSkin Skin material
|
||||
* @param newSkinData Skin item data
|
||||
* @param cost Cost of this MineStrike skin
|
||||
* @param displayMat Display material for GUI, no in-game impact
|
||||
* @param displayData Display data for GUI, no in-game impact
|
||||
*/
|
||||
public GameModifierMineStrikeSkin(GadgetManager manager, String name, String[] lore, String weaponName, Material newSkin, byte newSkinData,
|
||||
int cost, Material displayMat, int displayData)
|
||||
{
|
||||
super(manager, GameModifierType.MineStrike, name,
|
||||
UtilText.splitLinesToArray(lore, LineFormat.LORE), cost, displayMat, (byte) displayData);
|
||||
_weapon = weaponName;
|
||||
_skinMat = newSkin;
|
||||
_skinData = newSkinData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a {@link GameModifierMineStrikeSkin} with empty lore
|
||||
* @param manager Normal gadget manager
|
||||
* @param skin {@link MineStrikeSkin} used to apply name, item data and display data from
|
||||
* @param cost Cost of this MineStrike skin
|
||||
*/
|
||||
public GameModifierMineStrikeSkin(GadgetManager manager, MineStrikeSkin skin, int cost)
|
||||
{
|
||||
this(manager, skin, new String[]{""}, cost);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a {@link GameModifierMineStrikeSkin} using the {@link MineStrikeSkin} to apply additional data
|
||||
* @param manager Normal gadget manager
|
||||
* @param skin {@link MineStrikeSkin} used to apply name, item data and display data from
|
||||
* @param lore Lore to apply to the gadget
|
||||
* @param cost Cost of this MineStrike skin
|
||||
*/
|
||||
public GameModifierMineStrikeSkin(GadgetManager manager, MineStrikeSkin skin, String[] lore, int cost)
|
||||
{
|
||||
this(manager, skin.getSkinName(), lore, skin.getWeaponName(), skin.getSkinMaterial(), skin.getSkinData(), cost,
|
||||
skin.getSkinMaterial(), skin.getSkinData());
|
||||
}
|
||||
|
||||
public String getWeaponName()
|
||||
{
|
||||
return _weapon;
|
||||
}
|
||||
|
||||
public Material getSkinMaterial()
|
||||
{
|
||||
return _skinMat;
|
||||
}
|
||||
|
||||
public byte getSkinData()
|
||||
{
|
||||
return _skinData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void EnableCustom(Player player)
|
||||
{
|
||||
Manager.getGameModifiers(getGameType()).stream().filter(getWeaponFilter(_weapon)).forEach(g -> g.Disable(player));
|
||||
|
||||
super.EnableCustom(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple {@link GadgetGameModifier} filter which filters out {@link GameModifierMineStrikeSkin} gadgets depending on weapon name
|
||||
* @param weaponName Exact weapon name to test for
|
||||
* @return Returns a weapon filter which will filter out any {@link GadgetGameModifier}
|
||||
* which is not instance of {@link GameModifierMineStrikeSkin} and which does not match the provided weapon name
|
||||
*/
|
||||
public static Predicate<GadgetGameModifier> getWeaponFilter(String weaponName)
|
||||
{
|
||||
return g -> g instanceof GameModifierMineStrikeSkin && ((GameModifierMineStrikeSkin)g).getWeaponName().equals(weaponName);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package mineplex.core.gadget.gadgets.gamemodifiers.minestrike;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
public enum MineStrikeSkin
|
||||
{
|
||||
|
||||
P250_Muertos( "P250", "P250 Muertos", Material.INK_SACK, (byte) 3),
|
||||
CZ75_Auto_Tigris( "CZ75-Auto", "CZ75-Auto Tigris", Material.CLAY_BRICK, (byte) 0),
|
||||
Desert_Eagle_Blaze( "Desert Eagle", "Desert Eagle Blaze", Material.NETHER_STALK, (byte) 0),
|
||||
Nova_Koi( "Nova", "Nova Koi", Material.INK_SACK, (byte) 14),
|
||||
XM1014_Tranquility( "XM1014", "XM1014 Tranquility", Material.DIAMOND, (byte) 0),
|
||||
PP_Bizon_Streak( "PP Bizon", "PP-Bizon Streak", Material.INK_SACK, (byte) 4),
|
||||
P90_Asiimov( "P90", "P90 Asiimov", Material.INK_SACK, (byte) 0),
|
||||
SSG_08_Blood_in_the_Water( "SSG 08", "SSG 08 Blood in the Water", Material.INK_SACK, (byte) 12),
|
||||
AWP_Asiimov( "AWP", "AWP Asiimov", Material.SULPHUR, (byte) 0),
|
||||
P2000_Fire_Elemental( "P2000", "P2000 Fire Elemental", Material.INK_SACK, (byte) 6),
|
||||
FAMAS_Pulse( "FAMAS", "FAMAS Pulse", Material.CLAY_BALL, (byte) 0),
|
||||
M4A4_Howl( "M4A4", "M4A4 Howl", Material.INK_SACK, (byte) 11),
|
||||
Steyr_AUG_Torque( "Steyr AUG", "Steyr AUG Torque", Material.BLAZE_ROD, (byte) 0),
|
||||
Glock_18_Fade( "Glock 18", "Glock 18 Fade", Material.INK_SACK, (byte) 9),
|
||||
Galil_AR_Eco( "Galil AR", "Galil AR Eco", Material.INK_SACK, (byte) 10),
|
||||
AK_47_Vulcan( "AK-47", "AK-47 Vulcan", Material.INK_SACK, (byte) 7),
|
||||
SG553_Pulse( "SG553", "SG553 Pulse", Material.INK_SACK, (byte) 5),
|
||||
|
||||
Knife_M9_Bayonette_Fade( "Knife", "M9 Bayonette Fade", Material.DIAMOND_SWORD, (byte) 0);
|
||||
|
||||
|
||||
|
||||
private String _weaponName;
|
||||
private String _skinName;
|
||||
private Material _skinMaterial;
|
||||
private byte _skinData;
|
||||
|
||||
MineStrikeSkin(String weaponName, String skinName, Material newMaterial, byte newData)
|
||||
{
|
||||
_weaponName = weaponName;
|
||||
_skinName = skinName;
|
||||
_skinMaterial = newMaterial;
|
||||
_skinData = newData;
|
||||
}
|
||||
|
||||
public String getWeaponName()
|
||||
{
|
||||
return _weaponName;
|
||||
}
|
||||
|
||||
public String getSkinName()
|
||||
{
|
||||
return _skinName;
|
||||
}
|
||||
|
||||
public Material getSkinMaterial()
|
||||
{
|
||||
return _skinMaterial;
|
||||
}
|
||||
|
||||
public byte getSkinData()
|
||||
{
|
||||
return _skinData;
|
||||
}
|
||||
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package mineplex.core.gadget.gadgets.hat;
|
||||
|
||||
import mineplex.core.common.skin.SkinData;
|
||||
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.HatGadget;
|
||||
|
||||
public class HatCompanion extends HatGadget
|
||||
{
|
||||
public HatCompanion(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Companion",
|
||||
UtilText.splitLineToArray(C.cGray + "The Enrichment Center reminds you that the Weighted Companion Cube will never threaten to stab you and, in fact, cannot speak", LineFormat.LORE),
|
||||
-6,
|
||||
SkinData.COMPANION_CUBE.getSkull());
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package mineplex.core.gadget.gadgets.hat;
|
||||
|
||||
import mineplex.core.common.skin.SkinData;
|
||||
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.HatGadget;
|
||||
|
||||
public class HatCompanionBlock extends HatGadget
|
||||
{
|
||||
|
||||
public HatCompanionBlock(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Companion Block",
|
||||
UtilText.splitLineToArray(C.cGray + "The Enrichment Center is required to remind you that the Weighted Companion cube cannot talk. In the event that it does talk The Enrichment Center asks you to ignore its advice.", LineFormat.LORE),
|
||||
-2, SkinData.COMPANION_CUBE.getSkull(), "Companion Block");
|
||||
}
|
||||
|
||||
}
|
@ -9,11 +9,12 @@ import mineplex.core.gadget.types.HatGadget;
|
||||
|
||||
public class HatLovestruck extends HatGadget
|
||||
{
|
||||
|
||||
public HatLovestruck(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Lovestruck",
|
||||
super(manager, "Love Struck",
|
||||
UtilText.splitLineToArray(C.cGray + "I think I'm in love... Wait a minute, did someone use a love potion on me?!", LineFormat.LORE),
|
||||
-6,
|
||||
SkinData.LOVESTRUCK.getSkull());
|
||||
-6, SkinData.LOVESTRUCK.getSkull());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,11 +9,12 @@ import mineplex.core.gadget.types.HatGadget;
|
||||
|
||||
public class HatSecretPackage extends HatGadget
|
||||
{
|
||||
|
||||
public HatSecretPackage(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Secret Package",
|
||||
UtilText.splitLineToArray(C.cGray + "I hope Chiss is inside!", LineFormat.LORE),
|
||||
-6,
|
||||
SkinData.SECRET_PACKAGE.getSkull());
|
||||
-6, SkinData.SECRET_PACKAGE.getSkull());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -14,8 +14,7 @@ public class HatSnowman extends HatGadget
|
||||
{
|
||||
super(manager, "Snowman Head",
|
||||
UtilText.splitLineToArray(C.cGray + "Do you want to be a snowman?", LineFormat.LORE),
|
||||
-3,
|
||||
SkinData.SNOWMAN.getSkull());
|
||||
-2, SkinData.SNOWMAN.getSkull());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,13 +1,11 @@
|
||||
package mineplex.core.gadget.gadgets.outfit;
|
||||
package mineplex.core.gadget.gadgets.outfit.ravesuit;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
@ -1,4 +1,4 @@
|
||||
package mineplex.core.gadget.gadgets.outfit;
|
||||
package mineplex.core.gadget.gadgets.outfit.ravesuit;
|
||||
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user