Merge remote-tracking branch 'origin/master'
Conflicts: Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParticle.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java
This commit is contained in:
commit
910cdff935
Binary file not shown.
@ -1,5 +1,6 @@
|
||||
package mineplex.bungee.motd;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@ -53,23 +54,13 @@ public class MotdManager implements Listener, Runnable
|
||||
public void run()
|
||||
{
|
||||
// Add in default MOTD listing to database
|
||||
/*
|
||||
if (!_repository.elementExists("MainMotd"))
|
||||
{
|
||||
_repository.removeElement("MainMotd");
|
||||
|
||||
List<String> lines = new ArrayList<String>();
|
||||
lines.add(" §a§lDouble Gems for 1.8 Players!");
|
||||
lines.add(" §e§lChampions Update §a§lBalance Patch");
|
||||
lines.add(" §6§lSpecial Egg Baskets!");
|
||||
lines.add(" §e§lBunny Morph §a§lLimited Time!");
|
||||
lines.add(" §d§lHero Sale §a§l33% Off");
|
||||
lines.add(" §a§lDouble Gems for 1.8 Players!");
|
||||
lines.add(" §e§lNEW GAME §a§lWizards!");
|
||||
lines.add(" §d§lRank Sale §a§l40% Off");
|
||||
|
||||
updateMainMotd(" §b§l§m §8§l§m[ §r §9§lMineplex§r §f§lGames§r §8§l§m ]§b§l§m §r", lines);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
GlobalMotd motd = _repository.getElement("MainMotd");
|
||||
|
||||
if (motd != null)
|
||||
|
@ -4,11 +4,16 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import net.minecraft.server.v1_7_R4.Blocks;
|
||||
import net.minecraft.server.v1_7_R4.MathHelper;
|
||||
import net.minecraft.server.v1_7_R4.WorldServer;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class UtilBlock
|
||||
@ -304,7 +309,13 @@ public class UtilBlock
|
||||
return blockList;
|
||||
}
|
||||
|
||||
|
||||
public static HashMap<Block, Double> getInRadius(Block block, double dR)
|
||||
{
|
||||
return getInRadius(block, dR, false);
|
||||
}
|
||||
|
||||
public static HashMap<Block, Double> getInRadius(Block block, double dR, boolean hollow)
|
||||
{
|
||||
HashMap<Block, Double> blockList = new HashMap<Block, Double>();
|
||||
int iR = (int)dR + 1;
|
||||
@ -317,8 +328,10 @@ public class UtilBlock
|
||||
|
||||
double offset = UtilMath.offset(block.getLocation(), curBlock.getLocation());
|
||||
|
||||
if (offset <= dR)
|
||||
blockList.put(curBlock, 1 - (offset/dR));
|
||||
if (offset <= dR && !(hollow && offset < dR - 1))
|
||||
{
|
||||
blockList.put(curBlock, 1 - (offset / dR));
|
||||
}
|
||||
}
|
||||
|
||||
return blockList;
|
||||
@ -369,6 +382,74 @@ public class UtilBlock
|
||||
|
||||
return block.getRelative(BlockFace.UP);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param location of explosion
|
||||
* @param strength of explosion
|
||||
* @param damageBlocksEqually - Treat all blocks as durability of dirt
|
||||
* @param ensureDestruction - Ensure that the closest blocks are destroyed at least
|
||||
* @return
|
||||
*/
|
||||
public static ArrayList<Block> getExplosionBlocks(Location location, float strength, boolean damageBlocksEqually)
|
||||
{
|
||||
ArrayList<Block> toExplode = new ArrayList<Block>();
|
||||
WorldServer world = ((CraftWorld) location.getWorld()).getHandle();
|
||||
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
for (int j = 0; j < 16; j++)
|
||||
{
|
||||
for (int k = 0; k < 16; k++)
|
||||
{
|
||||
if ((i == 0) || (i == 16 - 1) || (j == 0) || (j == 16 - 1) || (k == 0) || (k == 16 - 1))
|
||||
{
|
||||
double d3 = i / (16 - 1.0F) * 2.0F - 1.0F;
|
||||
double d4 = j / (16 - 1.0F) * 2.0F - 1.0F;
|
||||
double d5 = k / (16 - 1.0F) * 2.0F - 1.0F;
|
||||
double d6 = Math.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
|
||||
|
||||
d3 /= d6;
|
||||
d4 /= d6;
|
||||
d5 /= d6;
|
||||
float f1 = strength * (0.7F + UtilMath.random.nextFloat() * 0.6F);
|
||||
|
||||
double d0 = location.getX();
|
||||
double d1 = location.getY();
|
||||
double d2 = location.getZ();
|
||||
|
||||
for (float f2 = 0.3F; f1 > 0.0F; f1 -= f2 * 0.75F)
|
||||
{
|
||||
int l = MathHelper.floor(d0);
|
||||
int i1 = MathHelper.floor(d1);
|
||||
int j1 = MathHelper.floor(d2);
|
||||
Block block = location.getWorld().getBlockAt(l, i1, j1);
|
||||
|
||||
if (block.getType() != Material.AIR)
|
||||
{
|
||||
float f3 = (damageBlocksEqually ? Blocks.DIRT : world.getType(block.getX(), block.getY(),
|
||||
block.getZ())).a((net.minecraft.server.v1_7_R4.Entity) null);
|
||||
|
||||
f1 -= (f3 + 0.3F) * f2;
|
||||
}
|
||||
|
||||
if ((f1 > 0.0F) && (i1 < 256) && (i1 >= 0))
|
||||
{
|
||||
toExplode.add(block);
|
||||
}
|
||||
|
||||
d0 += d3 * f2;
|
||||
d1 += d4 * f2;
|
||||
d2 += d5 * f2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return toExplode;
|
||||
}
|
||||
|
||||
public static ArrayList<Block> getSurrounding(Block block, boolean diagonals)
|
||||
{
|
||||
ArrayList<Block> blocks = new ArrayList<Block>();
|
||||
|
@ -1,168 +1,225 @@
|
||||
package mineplex.core.common.util;
|
||||
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutWorldParticles;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public class UtilParticle
|
||||
{
|
||||
public enum ParticleType
|
||||
{
|
||||
// TODO Update material data as well as friendly name
|
||||
HUGE_EXPLOSION("hugeexplosion", "Huge Explosion", Material.SAPLING, (byte) 0, true),
|
||||
LARGE_EXPLODE("largeexplode", "Large Explosion", Material.SAPLING, (byte) 0, true),
|
||||
FIREWORKS_SPARK("fireworksSpark", "Spark", Material.SAPLING, (byte) 0, true),
|
||||
BUBBLE("bubble", "Bubble", Material.SAPLING, (byte) 0, true),
|
||||
SUSPEND("suspended", "Suspended", Material.SAPLING, (byte) 0, true),
|
||||
DEPTH_SUSPEND("depthSuspend", "Depth Suspend", Material.SAPLING, (byte) 0, true),
|
||||
TOWN_AURA("townaura", "Town Aura", Material.SAPLING, (byte) 0, true),
|
||||
CRIT("crit", "Critical Hit", Material.SAPLING, (byte) 0, true),
|
||||
MAGIC_CRIT("magicCrit", "Magic Critical Hit", Material.SAPLING, (byte) 0, true),
|
||||
MOB_SPELL("mobSpell", "Mob Spell", Material.SAPLING, (byte) 0, true),
|
||||
MOB_SPELL_AMBIENT("mobSpellAmbient", "Mob Spell Ambient", Material.SAPLING, (byte) 0, true),
|
||||
SPELL("spell", "Spell", Material.SAPLING, (byte) 0, true),
|
||||
INSTANT_SPELL("instantSpell", "Instant Spell", Material.SAPLING, (byte) 0, true),
|
||||
WITCH_MAGIC("witchMagic", "Witch Magic", Material.SAPLING, (byte) 0, true),
|
||||
NOTE("note", "Note", Material.SAPLING, (byte) 0, true),
|
||||
PORTAL("portal", "Portal", Material.SAPLING, (byte) 0, true),
|
||||
ENCHANTMENT_TABLE("enchantmenttable", "Enchantment Table", Material.SAPLING, (byte) 0, true),
|
||||
EXPLODE("explode", "Explode", Material.SAPLING, (byte) 0, true),
|
||||
FLAME("flame", "Flame", Material.SAPLING, (byte) 0, true),
|
||||
LAVA("lava", "Lava", Material.SAPLING, (byte) 0, true),
|
||||
FOOTSTEP("footstep", "Footstep", Material.SAPLING, (byte) 0, true),
|
||||
SPLASH("splash", "Splash", Material.SAPLING, (byte) 0, true),
|
||||
LARGE_SMOKE("largesmoke", "Large Smoke", Material.SAPLING, (byte) 0, true),
|
||||
CLOUD("cloud", "Cloud", Material.SAPLING, (byte) 0, true),
|
||||
RED_DUST("reddust", "Red Dust", Material.SAPLING, (byte) 0, true),
|
||||
SNOWBALL_POOF("snowballpoof", "Snowball Poof", Material.SAPLING, (byte) 0, true),
|
||||
DRIP_WATER("dripWater", "Drip Water", Material.SAPLING, (byte) 0, true),
|
||||
DRIP_LAVA("dripLava", "Drip Lava", Material.SAPLING, (byte) 0, true),
|
||||
DROPLET("droplet", "Droplet", Material.SAPLING, (byte) 0, true),
|
||||
SNOW_SHOVEL("snowshovel", "Snow Shovel", Material.SAPLING, (byte) 0, true),
|
||||
SLIME("slime", "Slime", Material.SAPLING, (byte) 0, true),
|
||||
HEART("heart", "Heart", Material.SAPLING, (byte) 0, true),
|
||||
ANGRY_VILLAGER("angryVillager", "Angry Villager", Material.SAPLING, (byte) 0, true),
|
||||
HAPPY_VILLAGER("happyVillager", "Happy Villager", Material.SAPLING, (byte) 0, true);
|
||||
ANGRY_VILLAGER("angryVillager"),
|
||||
|
||||
public String particleName;
|
||||
private String _friendlyName;
|
||||
private Material _material;
|
||||
private byte _data;
|
||||
private boolean _displayGuis;
|
||||
|
||||
ParticleType(String particleName, String friendlyName, Material material, byte data, boolean displayGuis)
|
||||
{
|
||||
this.particleName = particleName;
|
||||
_friendlyName = friendlyName;
|
||||
_material = material;
|
||||
_data = data;
|
||||
_displayGuis = displayGuis;
|
||||
}
|
||||
|
||||
public String getFriendlyName()
|
||||
BLOCK_CRACK("blockcrack_1_0")
|
||||
{
|
||||
return _friendlyName;
|
||||
}
|
||||
|
||||
public Material getMaterial()
|
||||
{
|
||||
return _material;
|
||||
}
|
||||
|
||||
public byte getData()
|
||||
{
|
||||
return _data;
|
||||
}
|
||||
|
||||
public boolean shouldDisplayGuis()
|
||||
{
|
||||
return _displayGuis;
|
||||
}
|
||||
|
||||
public static ParticleType getFromFriendlyName(String name)
|
||||
{
|
||||
for (ParticleType t : values())
|
||||
@Override
|
||||
public String getParticle(Material type, int data)
|
||||
{
|
||||
if (t.getFriendlyName().equals(name))
|
||||
return t;
|
||||
return "blockcrack_" + type.getId() + "_" + data;
|
||||
}
|
||||
},
|
||||
|
||||
return null;
|
||||
BLOCK_DUST("blockdust_1_0")
|
||||
{
|
||||
@Override
|
||||
public String getParticle(Material type, int data)
|
||||
{
|
||||
return "blockdust_" + type.getId() + "_" + data;
|
||||
}
|
||||
},
|
||||
|
||||
BUBBLE("bubble"),
|
||||
|
||||
CLOUD("cloud"),
|
||||
|
||||
CRIT("crit"),
|
||||
|
||||
DEPTH_SUSPEND("depthSuspend"),
|
||||
|
||||
DRIP_LAVA("dripLava"),
|
||||
|
||||
DRIP_WATER("dripWater"),
|
||||
|
||||
DROPLET("droplet"),
|
||||
|
||||
ENCHANTMENT_TABLE("enchantmenttable"),
|
||||
|
||||
EXPLODE("explode"),
|
||||
|
||||
FIREWORKS_SPARK("fireworksSpark"),
|
||||
|
||||
FLAME("flame"),
|
||||
|
||||
FOOTSTEP("footstep"),
|
||||
|
||||
HAPPY_VILLAGER("happyVillager"),
|
||||
|
||||
HEART("heart"),
|
||||
|
||||
HUGE_EXPLOSION("hugeexplosion"),
|
||||
|
||||
ICON_CRACK("iconcrack_1_0")
|
||||
{
|
||||
@Override
|
||||
public String getParticle(Material type, int data)
|
||||
{
|
||||
return "iconcrack_" + type.getId() + "_" + data;
|
||||
}
|
||||
},
|
||||
|
||||
INSTANT_SPELL("instantSpell"),
|
||||
|
||||
LARGE_EXPLODE("largeexplode"),
|
||||
|
||||
LARGE_SMOKE("largesmoke"),
|
||||
|
||||
LAVA("lava"),
|
||||
|
||||
MAGIC_CRIT("magicCrit"),
|
||||
|
||||
/**
|
||||
* Can be colored if count is 0, color is RGB and depends on the offset of xyz
|
||||
*/
|
||||
MOB_SPELL("mobSpell"),
|
||||
|
||||
/**
|
||||
* Can be colored if count is 0, color is RGB and depends on the offset of xyz
|
||||
*/
|
||||
MOB_SPELL_AMBIENT("mobSpellAmbient"),
|
||||
|
||||
NOTE("note"),
|
||||
|
||||
PORTAL("portal"),
|
||||
|
||||
/**
|
||||
* Can be colored if count is 0, color is RGB and depends on the offset of xyz. Offset y if 0 will default to 1, counter by making it 0.0001
|
||||
*/
|
||||
RED_DUST("reddust"),
|
||||
|
||||
SLIME("slime"),
|
||||
|
||||
SNOW_SHOVEL("snowshovel"),
|
||||
|
||||
SNOWBALL_POOF("snowballpoof"),
|
||||
|
||||
SPELL("spell"),
|
||||
|
||||
SPLASH("splash"),
|
||||
|
||||
SUSPEND("suspended"),
|
||||
|
||||
TOWN_AURA("townaura"),
|
||||
|
||||
WITCH_MAGIC("witchMagic");
|
||||
|
||||
public String particleName;
|
||||
|
||||
ParticleType(String particleName)
|
||||
{
|
||||
this.particleName = particleName;
|
||||
}
|
||||
|
||||
public String getParticle(Material type, int data)
|
||||
{
|
||||
return particleName;
|
||||
}
|
||||
}
|
||||
|
||||
public static void PlayParticle(Player player, ParticleType type, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count)
|
||||
{
|
||||
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles();
|
||||
|
||||
for (Field field : packet.getClass().getDeclaredFields())
|
||||
{
|
||||
try
|
||||
{
|
||||
field.setAccessible(true);
|
||||
String fieldName = field.getName();
|
||||
switch (fieldName)
|
||||
{
|
||||
case "a":
|
||||
field.set(packet, type.particleName); //Particle name
|
||||
break;
|
||||
case "b":
|
||||
field.setFloat(packet, (float)location.getX()); //Block X
|
||||
break;
|
||||
case "c":
|
||||
field.setFloat(packet, (float)location.getY()); //Block Y
|
||||
break;
|
||||
case "d":
|
||||
field.setFloat(packet, (float)location.getZ()); //Block Z
|
||||
break;
|
||||
case "e":
|
||||
field.setFloat(packet, offsetX); //Random X Offset
|
||||
break;
|
||||
case "f":
|
||||
field.setFloat(packet, offsetY); //Random Y Offset
|
||||
break;
|
||||
case "g":
|
||||
field.setFloat(packet, offsetZ); //Random Z Offset
|
||||
break;
|
||||
case "h":
|
||||
field.setFloat(packet, speed); //Speed/data of particles
|
||||
break;
|
||||
case "i":
|
||||
field.setInt(packet, count); //Amount of particles
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println(e.getMessage());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
|
||||
public static void PlayParticle(ParticleType type, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count)
|
||||
private static PacketPlayOutWorldParticles getPacket(String particleName, Location location, float offsetX, float offsetY,
|
||||
float offsetZ, float speed, int count)
|
||||
{
|
||||
|
||||
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles();
|
||||
|
||||
for (Field field : packet.getClass().getDeclaredFields())
|
||||
{
|
||||
try
|
||||
{
|
||||
field.setAccessible(true);
|
||||
String fieldName = field.getName();
|
||||
switch (fieldName)
|
||||
{
|
||||
case "a":
|
||||
field.set(packet, particleName); // Particle name
|
||||
break;
|
||||
case "b":
|
||||
field.setFloat(packet, (float) location.getX()); // Block X
|
||||
break;
|
||||
case "c":
|
||||
field.setFloat(packet, (float) location.getY()); // Block Y
|
||||
break;
|
||||
case "d":
|
||||
field.setFloat(packet, (float) location.getZ()); // Block Z
|
||||
break;
|
||||
case "e":
|
||||
field.setFloat(packet, offsetX); // Random X Offset
|
||||
break;
|
||||
case "f":
|
||||
field.setFloat(packet, offsetY); // Random Y Offset
|
||||
break;
|
||||
case "g":
|
||||
field.setFloat(packet, offsetZ); // Random Z Offset
|
||||
break;
|
||||
case "h":
|
||||
field.setFloat(packet, speed); // Speed/data of particles
|
||||
break;
|
||||
case "i":
|
||||
field.setInt(packet, count); // Amount of particles
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
return packet;
|
||||
}
|
||||
|
||||
public static void PlayParticle(ParticleType type, Location location, float offsetX, float offsetY, float offsetZ,
|
||||
float speed, int count)
|
||||
{
|
||||
PlayParticle(type.particleName, location, offsetX, offsetY, offsetZ, speed, count);
|
||||
}
|
||||
|
||||
public static void PlayParticle(Player player, ParticleType type, Location location, float offsetX, float offsetY,
|
||||
float offsetZ, float speed, int count)
|
||||
{
|
||||
PlayParticle(player, type.particleName, location, offsetX, offsetY, offsetZ, speed, count);
|
||||
}
|
||||
|
||||
public static void PlayParticle(Player player, String particleName, Location location, float offsetX, float offsetY,
|
||||
float offsetZ, float speed, int count)
|
||||
{
|
||||
PacketPlayOutWorldParticles packet = getPacket(particleName, location, offsetX, offsetY, offsetZ, speed, count);
|
||||
|
||||
UtilPlayer.sendPacket(player, packet);
|
||||
}
|
||||
|
||||
public static void PlayParticle(String particleName, Location location, float offsetX, float offsetY, float offsetZ,
|
||||
float speed, int count)
|
||||
{
|
||||
PacketPlayOutWorldParticles packet = getPacket(particleName, location, offsetX, offsetY, offsetZ, speed, count);
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
//Dont send to players who cannot see it!
|
||||
if (type != ParticleType.FIREWORKS_SPARK &&
|
||||
type != ParticleType.LARGE_EXPLODE &&
|
||||
type != ParticleType.HUGE_EXPLOSION)
|
||||
// Dont send to players who cannot see it!
|
||||
if (!particleName.equals(ParticleType.FIREWORKS_SPARK.particleName)
|
||||
&& !particleName.equals(ParticleType.LARGE_EXPLODE.particleName)
|
||||
&& !particleName.equals(ParticleType.HUGE_EXPLOSION.particleName))
|
||||
{
|
||||
if (UtilMath.offset(player.getLocation(), location) > 24)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
PlayParticle(player, type, location, offsetX, offsetY, offsetZ, speed, count);
|
||||
|
||||
UtilPlayer.sendPacket(player, packet);
|
||||
}
|
||||
}
|
||||
}
|
@ -9,181 +9,237 @@ import org.bukkit.util.Vector;
|
||||
|
||||
public class UtilShapes
|
||||
{
|
||||
private final static BlockFace[] diagonalFaces =
|
||||
{
|
||||
BlockFace.SOUTH_WEST, BlockFace.NORTH_WEST, BlockFace.NORTH_EAST, BlockFace.SOUTH_EAST
|
||||
};
|
||||
private final static BlockFace[] diagonalFaces =
|
||||
{
|
||||
BlockFace.SOUTH_WEST, BlockFace.NORTH_WEST, BlockFace.NORTH_EAST, BlockFace.SOUTH_EAST
|
||||
};
|
||||
|
||||
private final static BlockFace[] radial =
|
||||
{
|
||||
BlockFace.SOUTH, BlockFace.SOUTH_WEST, BlockFace.WEST, BlockFace.NORTH_WEST, BlockFace.NORTH,
|
||||
BlockFace.NORTH_EAST, BlockFace.EAST, BlockFace.SOUTH_EAST
|
||||
};
|
||||
private final static BlockFace[] radial =
|
||||
{
|
||||
BlockFace.SOUTH, BlockFace.SOUTH_WEST, BlockFace.WEST, BlockFace.NORTH_WEST, BlockFace.NORTH,
|
||||
BlockFace.NORTH_EAST, BlockFace.EAST, BlockFace.SOUTH_EAST
|
||||
};
|
||||
|
||||
private final static BlockFace[] squareFaces =
|
||||
{
|
||||
BlockFace.SOUTH, BlockFace.WEST, BlockFace.NORTH, BlockFace.EAST
|
||||
};
|
||||
private final static BlockFace[] squareFaces =
|
||||
{
|
||||
BlockFace.SOUTH, BlockFace.WEST, BlockFace.NORTH, BlockFace.EAST
|
||||
};
|
||||
|
||||
public static ArrayList<Location> getCircle(Location loc, double radius, boolean hollow)
|
||||
{
|
||||
return getCircleBlocks(loc, radius, 0, hollow, false);
|
||||
}
|
||||
public static ArrayList<Location> getCircle(Location loc, double radius, boolean hollow)
|
||||
{
|
||||
return getCircleBlocks(loc, radius, 0, hollow, false);
|
||||
}
|
||||
|
||||
public static ArrayList<Location> getSphereBlocks(Location loc, double radius, double height, boolean hollow)
|
||||
{
|
||||
return getCircleBlocks(loc, radius, height, hollow, true);
|
||||
}
|
||||
public static ArrayList<Location> getSphereBlocks(Location loc, double radius, double height, boolean hollow)
|
||||
{
|
||||
return getCircleBlocks(loc, radius, height, hollow, true);
|
||||
}
|
||||
|
||||
private static ArrayList<Location> getCircleBlocks(Location loc, double radius, double height, boolean hollow, boolean sphere)
|
||||
{
|
||||
ArrayList<Location> circleblocks = new ArrayList<Location>();
|
||||
double cx = loc.getBlockX();
|
||||
double cy = loc.getBlockY();
|
||||
double cz = loc.getBlockZ();
|
||||
private static ArrayList<Location> getCircleBlocks(Location loc, double radius, double height, boolean hollow, boolean sphere)
|
||||
{
|
||||
ArrayList<Location> circleblocks = new ArrayList<Location>();
|
||||
double cx = loc.getBlockX();
|
||||
double cy = loc.getBlockY();
|
||||
double cz = loc.getBlockZ();
|
||||
|
||||
for (double y = (sphere ? cy - radius : cy); y < (sphere ? cy + radius : cy + height + 1); y++)
|
||||
{
|
||||
for (double x = cx - radius; x <= cx + radius; x++)
|
||||
{
|
||||
for (double z = cz - radius; z <= cz + radius; z++)
|
||||
{
|
||||
double dist = (cx - x) * (cx - x) + (cz - z) * (cz - z) + (sphere ? (cy - y) * (cy - y) : 0);
|
||||
for (double y = (sphere ? cy - radius : cy); y < (sphere ? cy + radius : cy + height + 1); y++)
|
||||
{
|
||||
for (double x = cx - radius; x <= cx + radius; x++)
|
||||
{
|
||||
for (double z = cz - radius; z <= cz + radius; z++)
|
||||
{
|
||||
double dist = (cx - x) * (cx - x) + (cz - z) * (cz - z) + (sphere ? (cy - y) * (cy - y) : 0);
|
||||
|
||||
if (dist < radius * radius && !(hollow && dist < (radius - 1) * (radius - 1)))
|
||||
{
|
||||
Location l = new Location(loc.getWorld(), x, y, z);
|
||||
circleblocks.add(l);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (dist < radius * radius && !(hollow && dist < (radius - 1) * (radius - 1)))
|
||||
{
|
||||
Location l = new Location(loc.getWorld(), x, y, z);
|
||||
circleblocks.add(l);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return circleblocks;
|
||||
}
|
||||
return circleblocks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the block at the exact corners, will return a diagonal.
|
||||
*
|
||||
* @Yeah ik this code sucks.
|
||||
*/
|
||||
public static BlockFace[] getCornerBlockFaces(Block b, BlockFace facing)
|
||||
{
|
||||
BlockFace left = null;
|
||||
BlockFace right = null;
|
||||
for (int i = 0; i < radial.length; i++)
|
||||
{
|
||||
if (radial[i] == facing)
|
||||
{
|
||||
int high = i + 2;
|
||||
if (high >= radial.length)
|
||||
high = high - radial.length;
|
||||
int low = i - 2;
|
||||
if (low < 0)
|
||||
low = radial.length + low;
|
||||
left = radial[low];
|
||||
right = radial[high];
|
||||
return new BlockFace[]
|
||||
{
|
||||
left, right
|
||||
};
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Gets the block at the exact corners, will return a diagonal.
|
||||
*
|
||||
* @Yeah ik this code sucks.
|
||||
*/
|
||||
public static BlockFace[] getCornerBlockFaces(Block b, BlockFace facing)
|
||||
{
|
||||
BlockFace left = null;
|
||||
BlockFace right = null;
|
||||
for (int i = 0; i < radial.length; i++)
|
||||
{
|
||||
if (radial[i] == facing)
|
||||
{
|
||||
int high = i + 2;
|
||||
if (high >= radial.length)
|
||||
high = high - radial.length;
|
||||
int low = i - 2;
|
||||
if (low < 0)
|
||||
low = radial.length + low;
|
||||
left = radial[low];
|
||||
right = radial[high];
|
||||
return new BlockFace[]
|
||||
{
|
||||
left, right
|
||||
};
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Block[] getCornerBlocks(Block b, BlockFace facing)
|
||||
{
|
||||
BlockFace[] faces = getSideBlockFaces(b, facing);
|
||||
return new Block[]
|
||||
{
|
||||
b.getRelative(faces[0]), b.getRelative(faces[1])
|
||||
};
|
||||
}
|
||||
public static Block[] getCornerBlocks(Block b, BlockFace facing)
|
||||
{
|
||||
BlockFace[] faces = getSideBlockFaces(facing);
|
||||
return new Block[]
|
||||
{
|
||||
b.getRelative(faces[0]), b.getRelative(faces[1])
|
||||
};
|
||||
}
|
||||
|
||||
public static BlockFace getFacing(float yaw)
|
||||
{
|
||||
return radial[Math.round(yaw / 45f) & 0x7];
|
||||
}
|
||||
public static BlockFace getFacing(float yaw)
|
||||
{
|
||||
return radial[Math.round(yaw / 45f) & 0x7];
|
||||
}
|
||||
|
||||
public static ArrayList<Location> getLinesDistancedPoints(Location startingPoint, Location endingPoint,
|
||||
double distanceBetweenParticles)
|
||||
{
|
||||
return getLinesLimitedPoints(startingPoint, endingPoint,
|
||||
(int) Math.ceil(startingPoint.distance(endingPoint) / distanceBetweenParticles));
|
||||
}
|
||||
public static ArrayList<Location> getLinesDistancedPoints(Location startingPoint, Location endingPoint,
|
||||
double distanceBetweenParticles)
|
||||
{
|
||||
return getLinesLimitedPoints(startingPoint, endingPoint,
|
||||
(int) Math.ceil(startingPoint.distance(endingPoint) / distanceBetweenParticles));
|
||||
}
|
||||
|
||||
public static ArrayList<Location> getLinesLimitedPoints(Location startingPoint, Location endingPoint, int amountOfPoints)
|
||||
{
|
||||
startingPoint = startingPoint.clone();
|
||||
Vector vector = endingPoint.toVector().subtract(startingPoint.toVector());
|
||||
vector.normalize();
|
||||
vector.multiply(startingPoint.distance(endingPoint) / (amountOfPoints + 1D));
|
||||
public static ArrayList<Location> getLinesLimitedPoints(Location startingPoint, Location endingPoint, int amountOfPoints)
|
||||
{
|
||||
startingPoint = startingPoint.clone();
|
||||
Vector vector = endingPoint.toVector().subtract(startingPoint.toVector());
|
||||
vector.normalize();
|
||||
vector.multiply(startingPoint.distance(endingPoint) / (amountOfPoints + 1D));
|
||||
|
||||
ArrayList<Location> locs = new ArrayList<Location>();
|
||||
for (int i = 0; i < amountOfPoints; i++)
|
||||
{
|
||||
locs.add(startingPoint.add(vector).clone());
|
||||
}
|
||||
return locs;
|
||||
}
|
||||
ArrayList<Location> locs = new ArrayList<Location>();
|
||||
for (int i = 0; i < amountOfPoints; i++)
|
||||
{
|
||||
locs.add(startingPoint.add(vector).clone());
|
||||
}
|
||||
return locs;
|
||||
}
|
||||
|
||||
public static ArrayList<Location> getPointsInCircle(Location center, int pointsAmount, double circleRadius)
|
||||
{
|
||||
ArrayList<Location> locs = new ArrayList<Location>();
|
||||
public static ArrayList<Location> getPointsInCircle(Location center, int pointsAmount, double circleRadius)
|
||||
{
|
||||
ArrayList<Location> locs = new ArrayList<Location>();
|
||||
|
||||
for (int i = 0; i < pointsAmount; i++)
|
||||
{
|
||||
double angle = ((2 * Math.PI) / pointsAmount) * i;
|
||||
double x = circleRadius * Math.cos(angle);
|
||||
double z = circleRadius * Math.sin(angle);
|
||||
Location loc = center.clone().add(x, 0, z);
|
||||
locs.add(loc);
|
||||
}
|
||||
return locs;
|
||||
}
|
||||
for (int i = 0; i < pointsAmount; i++)
|
||||
{
|
||||
double angle = ((2 * Math.PI) / pointsAmount) * i;
|
||||
double x = circleRadius * Math.cos(angle);
|
||||
double z = circleRadius * Math.sin(angle);
|
||||
Location loc = center.clone().add(x, 0, z);
|
||||
locs.add(loc);
|
||||
}
|
||||
return locs;
|
||||
}
|
||||
|
||||
public static ArrayList<Location> getDistancedCircle(Location center, double pointsDistance, double circleRadius)
|
||||
{
|
||||
return getPointsInCircle(center, (int) ((circleRadius * Math.PI * 2) / pointsDistance), circleRadius);
|
||||
}
|
||||
public static ArrayList<Location> getDistancedCircle(Location center, double pointsDistance, double circleRadius)
|
||||
{
|
||||
return getPointsInCircle(center, (int) ((circleRadius * Math.PI * 2) / pointsDistance), circleRadius);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a north/west/east/south block, never a diagonal.
|
||||
*/
|
||||
public static BlockFace[] getSideBlockFaces(Block b, BlockFace facing)
|
||||
{
|
||||
BlockFace left = null;
|
||||
BlockFace right = null;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
int modifierUp = (diagonalFaces[i] == facing ? 2 : squareFaces[i] == facing ? 1 : 0);
|
||||
if (modifierUp != 0)
|
||||
{
|
||||
int high = i + modifierUp;
|
||||
if (high >= squareFaces.length)
|
||||
high = high - squareFaces.length;
|
||||
int low = i - 1;
|
||||
if (low < 0)
|
||||
low = squareFaces.length + low;
|
||||
left = squareFaces[low];
|
||||
right = squareFaces[high];
|
||||
return new BlockFace[]
|
||||
{
|
||||
left, right
|
||||
};
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Returns a north/west/east/south block, never a diagonal.
|
||||
*/
|
||||
public static BlockFace[] getSideBlockFaces(BlockFace facing)
|
||||
{
|
||||
return getSideBlockFaces(facing, true);
|
||||
}
|
||||
|
||||
public static Block[] getSideBlocks(Block b, BlockFace facing)
|
||||
{
|
||||
BlockFace[] faces = getSideBlockFaces(b, facing);
|
||||
return new Block[]
|
||||
{
|
||||
b.getRelative(faces[0]), b.getRelative(faces[1])
|
||||
};
|
||||
}
|
||||
public static BlockFace[] getSideBlockFaces(BlockFace facing, boolean allowDiagonal)
|
||||
{
|
||||
|
||||
int[][] facesXZ;
|
||||
allowDiagonal = !allowDiagonal && (facing.getModX() != 0 && facing.getModZ() != 0);
|
||||
|
||||
facesXZ = new int[][]
|
||||
{
|
||||
|
||||
new int[]
|
||||
{
|
||||
allowDiagonal ? facing.getModX() : facing.getModZ(), allowDiagonal ? 0 : -facing.getModX()
|
||||
},
|
||||
|
||||
new int[]
|
||||
{
|
||||
allowDiagonal ? 0 : -facing.getModZ(), allowDiagonal ? facing.getModZ() : facing.getModX()
|
||||
}
|
||||
};
|
||||
|
||||
BlockFace[] faces = new BlockFace[2];
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
int[] f = facesXZ[i];
|
||||
|
||||
for (BlockFace face : BlockFace.values())
|
||||
{
|
||||
if (face.getModY() == 0)
|
||||
{
|
||||
if (f[0] == face.getModX() && f[1] == face.getModZ())
|
||||
{
|
||||
faces[i] = face;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (allowDiagonal && (facing == BlockFace.NORTH_EAST || facing == BlockFace.SOUTH_WEST))
|
||||
{
|
||||
faces = new BlockFace[]
|
||||
{
|
||||
faces[1], faces[0]
|
||||
};
|
||||
}
|
||||
|
||||
return faces;
|
||||
}
|
||||
|
||||
public static ArrayList<Block> getDiagonalBlocks(Block block, BlockFace facing, int blockWidth)
|
||||
{
|
||||
ArrayList<Block> blocks = new ArrayList<Block>();
|
||||
|
||||
if (facing.getModX() == 0 || facing.getModZ() == 0)
|
||||
{
|
||||
return blocks;
|
||||
}
|
||||
|
||||
BlockFace[] faces = getSideBlockFaces(facing);
|
||||
|
||||
for (BlockFace face : faces)
|
||||
{
|
||||
Location loc = block.getLocation().add(0.5 + (facing.getModX() / 2D), 0, 0.5 + (facing.getModZ() / 2D));
|
||||
|
||||
blocks.add(loc.add(face.getModX() / 2D, 0, face.getModZ() / 2D).getBlock());
|
||||
|
||||
for (int i = 1; i < blockWidth; i++)
|
||||
{
|
||||
blocks.add(loc.add(face.getModX(), 0, face.getModZ()).getBlock());
|
||||
}
|
||||
}
|
||||
|
||||
return blocks;
|
||||
}
|
||||
|
||||
public static Block[] getSideBlocks(Block b, BlockFace facing)
|
||||
{
|
||||
BlockFace[] faces = getSideBlockFaces(facing);
|
||||
|
||||
return new Block[]
|
||||
{
|
||||
b.getRelative(faces[0]), b.getRelative(faces[1])
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -207,82 +207,59 @@ public class Chat extends MiniPlugin
|
||||
|
||||
if (event.isAsynchronous())
|
||||
{
|
||||
final Player player = event.getPlayer();
|
||||
//final String plyrname = player.toString();
|
||||
final String plyrname = player.getUniqueId().toString();
|
||||
final String msg = event.getMessage().replaceAll("[^\\x00-\\x7F]", "").trim();
|
||||
//final String filtertype = "chat";
|
||||
final String filtertype = "moderate";
|
||||
final String dname = player.getPlayerListName();
|
||||
|
||||
|
||||
JSONObject message = buildJsonChatObject(filtertype, dname, plyrname, msg, _serverName, 1);
|
||||
String response = getResponseFromCleanSpeak(message, filtertype);
|
||||
String filteredMessage = getFilteredMessage(event.getPlayer(), event.getMessage());
|
||||
|
||||
if (response == null)
|
||||
for (Player onlinePlayer : event.getRecipients())
|
||||
{
|
||||
System.out.println("[ERROR] Unable to filter chat message...thanks a lot CleanSpeak.");
|
||||
return;
|
||||
onlinePlayer.sendMessage(String.format(event.getFormat(), event.getPlayer().getDisplayName(), filteredMessage));
|
||||
}
|
||||
|
||||
/* TESTING OUTPUT - POSSIBLY USEFUL
|
||||
System.out.println(message);
|
||||
System.out.println(response);
|
||||
System.out.println(JSONValue.parse(response));
|
||||
//NullPointerException occasionally happening, JSONValue.parse(String) returns null randomly, why?
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
public String getFilteredMessage(Player player, String originalMessage)
|
||||
{
|
||||
final String playerName = player.getUniqueId().toString();
|
||||
originalMessage = originalMessage.replaceAll("[^\\x00-\\x7F]", "").trim();
|
||||
final String filterType = "moderate";
|
||||
final String displayName = player.getPlayerListName();
|
||||
|
||||
JSONObject message = buildJsonChatObject(filterType, displayName, playerName, originalMessage, _serverName, 1);
|
||||
String response = getResponseFromCleanSpeak(message, filterType);
|
||||
|
||||
if (response == null)
|
||||
{
|
||||
System.out.println("[ERROR] Unable to filter chat message...thanks a lot CleanSpeak.");
|
||||
return originalMessage;
|
||||
}
|
||||
|
||||
/* TESTING OUTPUT - POSSIBLY USEFUL
|
||||
System.out.println(message);
|
||||
System.out.println(response);
|
||||
System.out.println(JSONValue.parse(response));
|
||||
//NullPointerException occasionally happening, JSONValue.parse(String) returns null randomly, why?
|
||||
|
||||
for (Object o : ((JSONObject)JSONValue.parse(response)).values())
|
||||
{
|
||||
System.out.println(o.toString());
|
||||
}
|
||||
*/
|
||||
|
||||
String filteredMsg = "";
|
||||
|
||||
filteredMsg = ((JSONObject) JSONValue.parse(response)).get("content").toString();
|
||||
if (filteredMsg.contains("parts"))
|
||||
{
|
||||
filteredMsg = ((JSONObject) JSONValue.parse(filteredMsg)).get("parts").toString();
|
||||
filteredMsg = filteredMsg.replace('[', ' ').replace(']', ' ').trim();
|
||||
filteredMsg = ((JSONObject) JSONValue.parse(filteredMsg)).get("replacement").toString();
|
||||
|
||||
for (Object o : ((JSONObject)JSONValue.parse(response)).values())
|
||||
{
|
||||
System.out.println(o.toString());
|
||||
}
|
||||
*/
|
||||
|
||||
String filteredMsg = "";
|
||||
|
||||
filteredMsg = ((JSONObject) JSONValue.parse(response)).get("content").toString();
|
||||
if (filteredMsg.contains("parts"))
|
||||
{
|
||||
filteredMsg = ((JSONObject) JSONValue.parse(filteredMsg)).get("parts").toString();
|
||||
filteredMsg = filteredMsg.replace('[', ' ').replace(']', ' ').trim();
|
||||
filteredMsg = ((JSONObject) JSONValue.parse(filteredMsg)).get("replacement").toString();
|
||||
|
||||
for (Player onlinePlayer : event.getRecipients())
|
||||
{
|
||||
onlinePlayer.sendMessage(String.format(event.getFormat(), event.getPlayer().getDisplayName(), filteredMsg));
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
/*
|
||||
int risk = Integer.parseInt(((JSONObject) JSONValue.parse(response)).get("risk").toString());
|
||||
|
||||
if (risk >= 5)
|
||||
{
|
||||
String filteredMessage = event.getMessage().replaceAll("[^\\x00-\\x7F]", "").trim();
|
||||
|
||||
if (parseHashes(response) == null)
|
||||
event.setMessage(ChatColor.RED + msg);
|
||||
else
|
||||
{
|
||||
JSONArray hashindex = parseHashes(response);
|
||||
String newmessage = hasher(hashindex, msg);
|
||||
String badmessage = (new StringBuilder().append(newmessage)).toString();
|
||||
|
||||
if (newmessage.contains("*"))
|
||||
{
|
||||
filteredMessage = badmessage;
|
||||
}
|
||||
}
|
||||
|
||||
for (Player onlinePlayer : event.getRecipients())
|
||||
{
|
||||
onlinePlayer.sendMessage(String.format(event.getFormat(), event.getPlayer().getDisplayName(), filteredMessage));
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
*/
|
||||
return filteredMsg;
|
||||
}
|
||||
else
|
||||
{
|
||||
return originalMessage;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,6 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -303,6 +302,11 @@ public class Explosion extends MiniPlugin
|
||||
}
|
||||
|
||||
public void BlockExplosion(Collection<Block> blockSet, Location mid, boolean onlyAbove)
|
||||
{
|
||||
BlockExplosion(blockSet, mid, onlyAbove, true);
|
||||
}
|
||||
|
||||
public void BlockExplosion(Collection<Block> blockSet, Location mid, boolean onlyAbove, boolean removeBlock)
|
||||
{
|
||||
if (blockSet.isEmpty())
|
||||
return;
|
||||
@ -320,7 +324,10 @@ public class Explosion extends MiniPlugin
|
||||
|
||||
blocks.put(cur, new AbstractMap.SimpleEntry<Integer, Byte>(cur.getTypeId(), cur.getData()));
|
||||
|
||||
cur.setType(Material.AIR);
|
||||
if (removeBlock)
|
||||
{
|
||||
cur.setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
|
||||
//DELAY
|
||||
|
@ -4,37 +4,32 @@ import java.util.ArrayList;
|
||||
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
public class ChestLoot
|
||||
{
|
||||
private int _totalLoot;
|
||||
private ArrayList<RandomItem> _randomItems = new ArrayList<RandomItem>();
|
||||
private int _totalLoot;
|
||||
private boolean _unbreakableLoot;
|
||||
|
||||
public ChestLoot(boolean unbreakableLoot)
|
||||
{
|
||||
_unbreakableLoot = unbreakableLoot;
|
||||
}
|
||||
|
||||
public ChestLoot()
|
||||
{
|
||||
this(false);
|
||||
}
|
||||
|
||||
public ChestLoot(boolean unbreakableLoot)
|
||||
{
|
||||
_unbreakableLoot = unbreakableLoot;
|
||||
}
|
||||
|
||||
public void cloneLoot(ChestLoot loot)
|
||||
{
|
||||
_totalLoot += loot._totalLoot;
|
||||
_randomItems.addAll(loot._randomItems);
|
||||
}
|
||||
|
||||
public void registerLoot(RandomItem item)
|
||||
{
|
||||
_totalLoot += item.getAmount();
|
||||
_randomItems.add(item);
|
||||
}
|
||||
|
||||
public ItemStack getLoot()
|
||||
{
|
||||
int no = UtilMath.r(_totalLoot);
|
||||
@ -60,4 +55,30 @@ public class ChestLoot
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void addLoot(ItemStack item, int amount)
|
||||
{
|
||||
addLoot(item, amount, item.getAmount(), item.getAmount());
|
||||
}
|
||||
|
||||
public void addLoot(ItemStack item, int amount, int minStackSize, int maxStackSize)
|
||||
{
|
||||
addLoot(new RandomItem(item, amount, minStackSize, maxStackSize));
|
||||
}
|
||||
|
||||
public void addLoot(Material material, int amount)
|
||||
{
|
||||
addLoot(material, amount, 1, 1);
|
||||
}
|
||||
|
||||
public void addLoot(Material material, int amount, int minStackSize, int maxStackSize)
|
||||
{
|
||||
addLoot(new ItemStack(material), amount, minStackSize, maxStackSize);
|
||||
}
|
||||
|
||||
public void addLoot(RandomItem item)
|
||||
{
|
||||
_totalLoot += item.getAmount();
|
||||
_randomItems.add(item);
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,11 @@ public class RandomItem
|
||||
private ItemStack _item;
|
||||
private int _min, _max;
|
||||
|
||||
public RandomItem(ItemStack item, int amount)
|
||||
{
|
||||
this(item, amount, item.getAmount(), item.getAmount());
|
||||
}
|
||||
|
||||
public RandomItem(ItemStack item, int amount, int minStackSize, int maxStackSize)
|
||||
{
|
||||
_amount = amount;
|
||||
@ -19,9 +24,9 @@ public class RandomItem
|
||||
_max = maxStackSize;
|
||||
}
|
||||
|
||||
public RandomItem(ItemStack item, int amount)
|
||||
public RandomItem(Material material, int amount)
|
||||
{
|
||||
this(item, amount, item.getAmount(), item.getAmount());
|
||||
this(material, amount, 1, 1);
|
||||
}
|
||||
|
||||
public RandomItem(Material material, int amount, int minStackSize, int maxStackSize)
|
||||
@ -32,9 +37,9 @@ public class RandomItem
|
||||
_max = maxStackSize;
|
||||
}
|
||||
|
||||
public RandomItem(Material material, int amount)
|
||||
public int getAmount()
|
||||
{
|
||||
this(material, amount, 1, 1);
|
||||
return _amount;
|
||||
}
|
||||
|
||||
public ItemStack getItemStack()
|
||||
@ -43,9 +48,4 @@ public class RandomItem
|
||||
|
||||
return _item;
|
||||
}
|
||||
|
||||
public int getAmount()
|
||||
{
|
||||
return _amount;
|
||||
}
|
||||
}
|
@ -13,6 +13,7 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import mineplex.core.MiniClientPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.chat.Chat;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
@ -46,11 +47,12 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
||||
private HashMap<UUID, BukkitRunnable> _messageTimeouts = new HashMap<UUID, BukkitRunnable>();
|
||||
private PreferencesManager _preferences;
|
||||
private Punish _punish;
|
||||
private Chat _chat;
|
||||
private LinkedList<String> _randomMessage;
|
||||
private String _serverName;
|
||||
|
||||
public MessageManager(JavaPlugin plugin, CoreClientManager clientManager, PreferencesManager preferences,
|
||||
IgnoreManager ignoreManager, Punish punish, FriendManager friendManager)
|
||||
IgnoreManager ignoreManager, Punish punish, FriendManager friendManager, Chat chat)
|
||||
{
|
||||
super("Message", plugin);
|
||||
|
||||
@ -59,6 +61,7 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
||||
_ignoreManager = ignoreManager;
|
||||
_punish = punish;
|
||||
_friendsManager = friendManager;
|
||||
_chat = chat;
|
||||
_serverName = getPlugin().getConfig().getString("serverstatus.name");
|
||||
|
||||
MessageHandler messageHandler = new MessageHandler(this);
|
||||
@ -181,6 +184,8 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
||||
return;
|
||||
}
|
||||
|
||||
message = _chat.getFilteredMessage(from, message);
|
||||
|
||||
// Inform
|
||||
UtilPlayer.message(from, C.cGold + "§l" + from.getName() + " > " + to.getName() + C.cYellow + " §l" + message);
|
||||
|
||||
@ -278,6 +283,9 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
||||
_randomMessage.add("i like pie.");
|
||||
_randomMessage.add("Do you play Clash of Clans?");
|
||||
_randomMessage.add("Mmm...Steak!");
|
||||
_randomMessage.add("Poop! Poop everywhere!");
|
||||
_randomMessage.add("I'm so forgetful. Like I was going to say somethin...wait what were we talking about?");
|
||||
_randomMessage.add("Mmm...Steak!");
|
||||
}
|
||||
|
||||
public CoreClientManager GetClientManager()
|
||||
|
@ -0,0 +1,41 @@
|
||||
package mineplex.core.resourcepack;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.resourcepack.redis.RedisUnloadResPack;
|
||||
import mineplex.serverdata.commands.CommandCallback;
|
||||
import mineplex.serverdata.commands.ServerCommand;
|
||||
import mineplex.serverdata.commands.ServerCommandManager;
|
||||
|
||||
public class ResPackManager implements CommandCallback
|
||||
{
|
||||
private ResUnloadCheck _packUnloadCheck;
|
||||
|
||||
public ResPackManager(ResUnloadCheck packUnloadCheck)
|
||||
{
|
||||
_packUnloadCheck = packUnloadCheck;
|
||||
|
||||
ServerCommandManager.getInstance().registerCommandType("RedisUnloadResPack", RedisUnloadResPack.class, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(ServerCommand command)
|
||||
{
|
||||
if (command instanceof RedisUnloadResPack)
|
||||
{
|
||||
RedisUnloadResPack redisCommand = (RedisUnloadResPack) command;
|
||||
|
||||
Player player = Bukkit.getPlayerExact(redisCommand.getPlayer());
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
if (_packUnloadCheck.canSendUnload(player))
|
||||
{
|
||||
player.setResourcePack("http://www.chivebox.com/file/c/empty.zip");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package mineplex.core.resourcepack;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public interface ResUnloadCheck
|
||||
{
|
||||
|
||||
public boolean canSendUnload(Player player);
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package mineplex.core.resourcepack.redis;
|
||||
|
||||
import mineplex.serverdata.commands.ServerCommand;
|
||||
|
||||
public class RedisUnloadResPack extends ServerCommand
|
||||
{
|
||||
private String _player;
|
||||
|
||||
public RedisUnloadResPack(String player)
|
||||
{
|
||||
|
||||
_player = player;
|
||||
}
|
||||
|
||||
public String getPlayer()
|
||||
{
|
||||
return _player;
|
||||
}
|
||||
}
|
@ -50,7 +50,7 @@ public class ServerConfiguration extends MiniPlugin
|
||||
|
||||
_plugin.getServer().setWhitelist(_serverGroup.getWhitelist());
|
||||
((CraftServer)_plugin.getServer()).getServer().setPvP(_serverGroup.getPvp());
|
||||
((CraftServer)_plugin.getServer()).getServer().setTexturePack(_serverGroup.getResourcePack());
|
||||
//((CraftServer)_plugin.getServer()).getServer().setTexturePack(_serverGroup.getResourcePack());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -36,6 +36,8 @@ import mineplex.core.preferences.PreferencesManager;
|
||||
import mineplex.core.projectile.ProjectileManager;
|
||||
import mineplex.core.punish.Punish;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.resourcepack.ResUnloadCheck;
|
||||
import mineplex.core.resourcepack.ResPackManager;
|
||||
import mineplex.core.serverConfig.ServerConfiguration;
|
||||
import mineplex.core.spawn.Spawn;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
@ -109,8 +111,7 @@ public class Hub extends JavaPlugin implements IRelation
|
||||
|
||||
IgnoreManager ignoreManager = new IgnoreManager(this, clientManager, preferenceManager, portal);
|
||||
|
||||
FriendManager friendManager = new FriendManager(this, clientManager, preferenceManager, portal);
|
||||
new MessageManager(this, clientManager, preferenceManager, ignoreManager, punish, friendManager);
|
||||
FriendManager friendManager = new FriendManager(this, clientManager, preferenceManager, portal);
|
||||
|
||||
StatsManager statsManager = new StatsManager(this, clientManager);
|
||||
AchievementManager achievementManager = new AchievementManager(statsManager, clientManager, donationManager);
|
||||
@ -122,11 +123,19 @@ public class Hub extends JavaPlugin implements IRelation
|
||||
QueueManager queueManager = new QueueManager(this, clientManager, donationManager, new EloManager(this, clientManager), partyManager);
|
||||
|
||||
new ServerManager(this, clientManager, donationManager, portal, partyManager, serverStatusManager, hubManager, new StackerManager(hubManager), queueManager);
|
||||
new Chat(this, clientManager, preferenceManager, serverStatusManager.getCurrentServerName());
|
||||
Chat chat = new Chat(this, clientManager, preferenceManager, serverStatusManager.getCurrentServerName());
|
||||
new MessageManager(this, clientManager, preferenceManager, ignoreManager, punish, friendManager, chat);
|
||||
new MemoryFix(this);
|
||||
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion());
|
||||
new CustomTagFix(this, packetHandler);
|
||||
new TablistFix(this);
|
||||
new ResPackManager(new ResUnloadCheck()
|
||||
{
|
||||
public boolean canSendUnload(Player player)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
});
|
||||
//new Replay(this, packetHandler);
|
||||
new PersonalServerManager(this, clientManager);
|
||||
|
||||
|
@ -744,4 +744,9 @@ public class ServerManager extends MiniPlugin
|
||||
{
|
||||
return _serverNpcShopMap.get("Mine-Strike");
|
||||
}
|
||||
|
||||
public ShopBase<ServerManager> getWizardShop()
|
||||
{
|
||||
return _serverNpcShopMap.get("Wizards");
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ import mineplex.hub.server.ui.button.SelectMSButton;
|
||||
import mineplex.hub.server.ui.button.SelectSGButton;
|
||||
import mineplex.hub.server.ui.button.SelectSSMButton;
|
||||
import mineplex.hub.server.ui.button.SelectTDMButton;
|
||||
import mineplex.hub.server.ui.button.SelectWIZButton;
|
||||
|
||||
public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
|
||||
{
|
||||
@ -35,7 +36,7 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
|
||||
|
||||
public ServerGameMenu(ServerManager plugin, QuickShop quickShop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
|
||||
{
|
||||
super(plugin, quickShop, clientManager, donationManager, name, player, 27);
|
||||
super(plugin, quickShop, clientManager, donationManager, name, player, 56);
|
||||
|
||||
createSuperSmashCycle();
|
||||
createMinigameCycle();
|
||||
@ -74,12 +75,12 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
|
||||
|
||||
this.setItem(6, _superSmashCycle.get(_ssmIndex));
|
||||
|
||||
this.setItem(8, ItemStackFactory.Instance.CreateStack(Material.GRASS.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Block Hunt " + C.cGray + "Cat and Mouse", new String[]
|
||||
this.setItem(8, ItemStackFactory.Instance.CreateStack(Material.BLAZE_ROD.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Wizards " + C.cGray + "Last Man Standing", new String[]
|
||||
{
|
||||
ChatColor.RESET + "",
|
||||
ChatColor.RESET + "Hide as blocks/animals, upgrade your ",
|
||||
ChatColor.RESET + "weapon and fight to survive against",
|
||||
ChatColor.RESET + "the Hunters!",
|
||||
ChatColor.RESET + "Wield powerful spells to fight",
|
||||
ChatColor.RESET + "against other players in this",
|
||||
ChatColor.RESET + "exciting free-for-all brawl!",
|
||||
}));
|
||||
|
||||
this.setItem(18, ItemStackFactory.Instance.CreateStack(Material.BOOK_AND_QUILL.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Draw My Thing " + C.cGray + "Pictionary!", new String[]
|
||||
@ -113,20 +114,29 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
|
||||
ChatColor.RESET + "and battle with the opposing team to the",
|
||||
ChatColor.RESET + "last man standing.",
|
||||
}));
|
||||
|
||||
this.setItem(26, ItemStackFactory.Instance.CreateStack(Material.GRASS.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Block Hunt " + C.cGray + "Cat and Mouse", new String[]
|
||||
{
|
||||
ChatColor.RESET + "",
|
||||
ChatColor.RESET + "Hide as blocks/animals, upgrade your ",
|
||||
ChatColor.RESET + "weapon and fight to survive against",
|
||||
ChatColor.RESET + "the Hunters!",
|
||||
}));
|
||||
|
||||
this.setItem(26, _minigameCycle.get(_minigameIndex));
|
||||
this.setItem(40, _minigameCycle.get(_minigameIndex));
|
||||
|
||||
getButtonMap().put(0, new SelectBRButton(this));
|
||||
getButtonMap().put(2, new SelectSGButton(this));
|
||||
getButtonMap().put(4, new SelectMSButton(this));
|
||||
getButtonMap().put(6, new SelectSSMButton(this));
|
||||
getButtonMap().put(8, new SelectBHButton(this));
|
||||
getButtonMap().put(8, new SelectWIZButton(this));
|
||||
|
||||
getButtonMap().put(18, new SelectDMTButton(this));
|
||||
getButtonMap().put(20, new SelectCSButton(this));
|
||||
getButtonMap().put(22, new SelectDOMButton(this));
|
||||
getButtonMap().put(24, new SelectTDMButton(this));
|
||||
getButtonMap().put(26, new SelectMINButton(this));
|
||||
getButtonMap().put(26, new SelectBHButton(this));
|
||||
getButtonMap().put(40, new SelectMINButton(this));
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@ -407,4 +417,9 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
|
||||
{
|
||||
getPlugin().getMinestrikeShop().attemptShopOpen(player);
|
||||
}
|
||||
|
||||
public void OpenWIZ(Player player)
|
||||
{
|
||||
getPlugin().getWizardShop().attemptShopOpen(player);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,23 @@
|
||||
package mineplex.hub.server.ui.button;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.hub.server.ui.ServerGameMenu;
|
||||
|
||||
public class SelectWIZButton implements IButton
|
||||
{
|
||||
private ServerGameMenu _menu;
|
||||
|
||||
public SelectWIZButton(ServerGameMenu menu)
|
||||
{
|
||||
_menu = menu;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
_menu.OpenWIZ(player);
|
||||
}
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
package mineplex.minecraft.game.core.explosion;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@ -45,8 +47,15 @@ public class CustomExplosion extends Explosion
|
||||
private boolean _createFire;
|
||||
private boolean _ignoreRate = true;
|
||||
private float _blockExplosionSize;
|
||||
private boolean _fallingBlockExplosion;
|
||||
private mineplex.core.explosion.Explosion _explosion;
|
||||
private float _damage;
|
||||
private boolean _useCustomDamage;
|
||||
private int _maxFallingBlocks = -1;
|
||||
private float _maxDamage = 1000;
|
||||
|
||||
public CustomExplosion(DamageManager manager, Location loc, float explosionSize, String deathCause)
|
||||
public CustomExplosion(DamageManager manager, mineplex.core.explosion.Explosion explosion, Location loc, float explosionSize,
|
||||
String deathCause)
|
||||
{
|
||||
super(((CraftWorld) loc.getWorld()).getHandle(), null, loc.getX(), loc.getY(), loc.getZ(), explosionSize);
|
||||
|
||||
@ -54,6 +63,25 @@ public class CustomExplosion extends Explosion
|
||||
_manager = manager;
|
||||
_damageReason = deathCause;
|
||||
_blockExplosionSize = explosionSize;
|
||||
_explosion = explosion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Center of explosion does this much damage
|
||||
*/
|
||||
public CustomExplosion setExplosionDamage(float damage)
|
||||
{
|
||||
_damage = damage;
|
||||
_useCustomDamage = true;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public CustomExplosion setMaxDamage(float maxDamage)
|
||||
{
|
||||
_maxDamage = maxDamage;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public CustomExplosion setBlockExplosionSize(float explosionSize)
|
||||
@ -70,6 +98,20 @@ public class CustomExplosion extends Explosion
|
||||
return this;
|
||||
}
|
||||
|
||||
public CustomExplosion setFallingBlockExplosion(boolean fallingBlockExplosion)
|
||||
{
|
||||
_fallingBlockExplosion = fallingBlockExplosion;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public CustomExplosion setFallingBlockExplosionAmount(int maxFallingBlocks)
|
||||
{
|
||||
_maxFallingBlocks = maxFallingBlocks;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public CustomExplosion setDamageBlocks(boolean damageBlocks)
|
||||
{
|
||||
b = damageBlocks;
|
||||
@ -204,9 +246,21 @@ public class CustomExplosion extends Explosion
|
||||
d0 /= d8;
|
||||
d1 /= d8;
|
||||
d2 /= d8;
|
||||
|
||||
// Performs a raytrace that determines the percentage of solid blocks between the two
|
||||
double d9 = this._world.a(vec3d, entity.boundingBox);
|
||||
double d10 = (1.0D - d7) * d9;
|
||||
int damage = (int) ((d10 * d10 + d10) / 2.0D * 8.0D * this.size + 1.0D);
|
||||
float damage;
|
||||
|
||||
if (_useCustomDamage)
|
||||
{
|
||||
damage = Math.max(0, (int) ((_damage * d9) * (d8 / size)));
|
||||
}
|
||||
else
|
||||
{
|
||||
damage = (int) ((d10 * d10 + d10) / 2.0D * 8.0D * this.size + 1.0D);
|
||||
damage = Math.min(damage, _maxDamage);
|
||||
}
|
||||
|
||||
if (entity.getBukkitEntity() instanceof LivingEntity)
|
||||
{
|
||||
@ -282,6 +336,27 @@ public class CustomExplosion extends Explosion
|
||||
return;
|
||||
}
|
||||
|
||||
if (_fallingBlockExplosion)
|
||||
{
|
||||
Collection<org.bukkit.block.Block> blocks = event.GetBlocks();
|
||||
|
||||
if (blocks.size() > _maxFallingBlocks)
|
||||
{
|
||||
blocks = new ArrayList<org.bukkit.block.Block>(blocks);
|
||||
|
||||
Collections.shuffle((ArrayList) blocks);
|
||||
|
||||
int toRemove = blocks.size() - _maxFallingBlocks;
|
||||
|
||||
for (int i = 0; i < toRemove; i++)
|
||||
{
|
||||
blocks.remove(0);
|
||||
}
|
||||
}
|
||||
|
||||
_explosion.BlockExplosion(blocks, new Location(_world.getWorld(), posX, posY, posZ), false, false);
|
||||
}
|
||||
|
||||
Iterator iterator = this.blocks.iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
|
@ -12,6 +12,7 @@ import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.antihack.AntiHack;
|
||||
import mineplex.core.blockrestore.BlockRestore;
|
||||
import mineplex.core.blood.Blood;
|
||||
import mineplex.core.chat.Chat;
|
||||
import mineplex.core.command.CommandCenter;
|
||||
import mineplex.core.common.util.FileUtil;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
@ -113,7 +114,8 @@ public class Arcade extends JavaPlugin
|
||||
IgnoreManager ignoreManager = new IgnoreManager(this, _clientManager, preferenceManager, portal);
|
||||
|
||||
FriendManager friendManager = new FriendManager(this, _clientManager, preferenceManager, portal);
|
||||
new MessageManager(this, _clientManager, preferenceManager, ignoreManager, punish, friendManager);
|
||||
Chat chat = new Chat(this, _clientManager, preferenceManager, serverStatusManager.getCurrentServerName());
|
||||
new MessageManager(this, _clientManager, preferenceManager, ignoreManager, punish, friendManager, chat);
|
||||
|
||||
BlockRestore blockRestore = new BlockRestore(this);
|
||||
|
||||
@ -129,7 +131,7 @@ public class Arcade extends JavaPlugin
|
||||
cosmeticManager.setInterfaceSlot(7);
|
||||
|
||||
//Arcade Manager
|
||||
_gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, disguiseManager, creature, teleport, new Blood(this), portal, preferenceManager, inventoryManager, packetHandler, cosmeticManager, projectileManager, petManager, hologramManager, webServerAddress);
|
||||
_gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, disguiseManager, creature, teleport, new Blood(this), chat, portal, preferenceManager, inventoryManager, packetHandler, cosmeticManager, projectileManager, petManager, hologramManager, webServerAddress);
|
||||
|
||||
new MemoryFix(this);
|
||||
new CustomTagFix(this, packetHandler);
|
||||
|
@ -3,12 +3,15 @@ package nautilus.game.arcade;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -30,6 +33,8 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.server.ServerListPingEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.achievement.AchievementManager;
|
||||
@ -39,11 +44,12 @@ import mineplex.core.chat.Chat;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
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.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.cosmetic.CosmeticManager;
|
||||
import mineplex.core.creature.Creature;
|
||||
import mineplex.core.disguise.DisguiseManager;
|
||||
@ -55,12 +61,19 @@ import mineplex.core.hologram.HologramManager;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.movement.Movement;
|
||||
import mineplex.core.packethandler.IPacketHandler;
|
||||
import mineplex.core.packethandler.PacketHandler;
|
||||
import mineplex.core.packethandler.PacketInfo;
|
||||
import mineplex.core.packethandler.PacketPlayResourcePackStatus;
|
||||
import mineplex.core.packethandler.PacketPlayResourcePackStatus.EnumResourcePackStatus;
|
||||
import mineplex.core.party.PartyManager;
|
||||
import mineplex.core.pet.PetManager;
|
||||
import mineplex.core.portal.Portal;
|
||||
import mineplex.core.preferences.PreferencesManager;
|
||||
import mineplex.core.projectile.ProjectileManager;
|
||||
import mineplex.core.resourcepack.ResUnloadCheck;
|
||||
import mineplex.core.resourcepack.ResPackManager;
|
||||
import mineplex.core.resourcepack.redis.RedisUnloadResPack;
|
||||
import mineplex.core.reward.RewardRarity;
|
||||
import mineplex.core.reward.rewards.PetReward;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
@ -68,7 +81,6 @@ import mineplex.core.status.ServerStatusManager;
|
||||
import mineplex.core.task.TaskManager;
|
||||
import mineplex.core.teleport.Teleport;
|
||||
import mineplex.core.timing.TimingManager;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.classcombat.Class.ClassManager;
|
||||
import mineplex.minecraft.game.classcombat.Condition.SkillConditionManager;
|
||||
@ -109,7 +121,6 @@ import nautilus.game.arcade.managers.GameSpectatorManager;
|
||||
import nautilus.game.arcade.managers.GameStatManager;
|
||||
import nautilus.game.arcade.managers.GameTournamentManager;
|
||||
import nautilus.game.arcade.managers.GameWorldManager;
|
||||
import nautilus.game.arcade.managers.HolidayManager;
|
||||
import nautilus.game.arcade.managers.IdleManager;
|
||||
import nautilus.game.arcade.managers.MiscManager;
|
||||
import nautilus.game.arcade.shop.ArcadeShop;
|
||||
@ -169,6 +180,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
private PacketHandler _packetHandler;
|
||||
|
||||
|
||||
private IPacketHandler _resourcePacketHandler;
|
||||
private String _resourcePackUrl;
|
||||
private boolean _resourcePackRequired;
|
||||
private NautHashMap<String, EnumResourcePackStatus> _resourcePackUsers = new NautHashMap<String, EnumResourcePackStatus>();
|
||||
private NautHashMap<String, Long> _resourcePackNoResponse = new NautHashMap<String, Long>();
|
||||
|
||||
// Observers
|
||||
private HashSet<Player> _specList = new HashSet<Player>();
|
||||
@ -184,7 +200,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
|
||||
public ArcadeManager(Arcade plugin, ServerStatusManager serverStatusManager, GameServerConfig serverConfig,
|
||||
CoreClientManager clientManager, DonationManager donationManager, DamageManager damageManager,
|
||||
DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood,
|
||||
DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, Chat chat,
|
||||
Portal portal, PreferencesManager preferences, InventoryManager inventoryManager, PacketHandler packetHandler,
|
||||
CosmeticManager cosmeticManager, ProjectileManager projectileManager, PetManager petManager, HologramManager hologramManager, String webAddress)
|
||||
{
|
||||
@ -215,8 +231,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
|
||||
_clientManager = clientManager;
|
||||
_serverStatusManager = serverStatusManager;
|
||||
_chat = new Chat(plugin, _clientManager, preferences, _serverStatusManager.getCurrentServerName());
|
||||
|
||||
_chat = chat;
|
||||
_creature = creature;
|
||||
|
||||
_damageManager = damageManager;
|
||||
@ -301,6 +316,76 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
}
|
||||
}, 80L);
|
||||
}
|
||||
|
||||
_resourcePacketHandler = new IPacketHandler()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void handle(PacketInfo packetInfo)
|
||||
{
|
||||
if (_resourcePackUrl != null && packetInfo.getPacket() instanceof PacketPlayResourcePackStatus)
|
||||
{
|
||||
|
||||
final Player player = packetInfo.getPlayer();
|
||||
final EnumResourcePackStatus response = ((PacketPlayResourcePackStatus) packetInfo.getPacket())
|
||||
.getResourcePackStatus();
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(_plugin, new Runnable()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (_resourcePackRequired)
|
||||
{
|
||||
if (response == EnumResourcePackStatus.ACCEPTED)
|
||||
{
|
||||
_resourcePackNoResponse.remove(player.getName());
|
||||
}
|
||||
else if (response == EnumResourcePackStatus.DECLINED)
|
||||
{
|
||||
_resourcePackNoResponse.remove(player.getName());
|
||||
|
||||
returnHubNoResPack(player, "You need to accept the resource pack!");
|
||||
}
|
||||
else if (response == EnumResourcePackStatus.FAILED_DOWNLOAD)
|
||||
{
|
||||
_resourcePackNoResponse.remove(player.getName());
|
||||
|
||||
returnHubNoResPack(player, "Failed to download resource pack!");
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (response == EnumResourcePackStatus.ACCEPTED || response == EnumResourcePackStatus.LOADED)
|
||||
{
|
||||
_resourcePackUsers.put(player.getName(), response);
|
||||
}
|
||||
else
|
||||
{
|
||||
_resourcePackUsers.remove(player.getName());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
new ResPackManager(new ResUnloadCheck()
|
||||
{
|
||||
public boolean canSendUnload(Player player)
|
||||
{
|
||||
if (_resourcePackUsers.containsKey(player.getName()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
getPacketHandler().addPacketHandler(_resourcePacketHandler);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1225,4 +1310,129 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
return UtilPlayer.isSpectator((Player)player);
|
||||
return false;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onSecond(UpdateEvent event)
|
||||
{
|
||||
Iterator<Entry<String, Long>> itel = _resourcePackNoResponse.entrySet().iterator();
|
||||
|
||||
while (itel.hasNext())
|
||||
{
|
||||
Entry<String, Long> entry = itel.next();
|
||||
|
||||
if (UtilTime.elapsed(entry.getValue(), 10000))
|
||||
{
|
||||
Player player = Bukkit.getPlayerExact(entry.getKey());
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
// Send it again, enforce it!
|
||||
_resourcePackNoResponse.put(player.getName(), System.currentTimeMillis());
|
||||
player.setResourcePack(_resourcePackUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
itel.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ResourcePackQuit(PlayerQuitEvent event)
|
||||
{
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
EnumResourcePackStatus status = _resourcePackUsers.get(player.getName());
|
||||
|
||||
if (status == EnumResourcePackStatus.ACCEPTED || status == EnumResourcePackStatus.LOADED)
|
||||
{
|
||||
|
||||
new RedisUnloadResPack(player.getName()).publish();
|
||||
|
||||
_resourcePackUsers.remove(player.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void outdatedVersion(GameStateChangeEvent event)
|
||||
{
|
||||
if (!_resourcePackRequired)
|
||||
return;
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
if (!UtilPlayer.is1_8(player))
|
||||
returnHubNoResPack(player, "You need to be using 1.8 to play " + GetGame().GetName() + "!");
|
||||
}
|
||||
}
|
||||
|
||||
private void returnHubNoResPack(Player player, String message)
|
||||
{
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, C.cGold + C.Bold + message);
|
||||
UtilPlayer.message(player, " ");
|
||||
|
||||
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 10f, 1f);
|
||||
GetPortal().sendPlayerToServer(player, "Lobby");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ResourcePackJoin(PlayerJoinEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!UtilPlayer.is1_8(player) && _resourcePackRequired)
|
||||
{
|
||||
returnHubNoResPack(player, "You need to be using 1.8 to play " + GetGame().GetName() + "!");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (_resourcePackUrl != null)
|
||||
{
|
||||
if (_resourcePackRequired)
|
||||
{
|
||||
_resourcePackNoResponse.put(player.getName(), System.currentTimeMillis());
|
||||
}
|
||||
|
||||
_resourcePackUsers.put(player.getName(), null);
|
||||
player.setResourcePack(_resourcePackUrl);
|
||||
}
|
||||
}
|
||||
|
||||
public void setResourcePack(String resourcePack, boolean forceResourcePack)
|
||||
{
|
||||
if (!Objects.equal(resourcePack, _resourcePackUrl) || forceResourcePack != _resourcePackRequired)
|
||||
{
|
||||
_resourcePackNoResponse.clear();
|
||||
_resourcePackUsers.clear();
|
||||
_resourcePackUrl = resourcePack == null || resourcePack.isEmpty() ? null : resourcePack;
|
||||
_resourcePackRequired = forceResourcePack;
|
||||
|
||||
if (_resourcePackUrl == null || _resourcePackUrl.isEmpty())
|
||||
{
|
||||
_resourcePackRequired = false;
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
player.setResourcePack("http://www.chivebox.com/file/c/empty.zip");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (_resourcePackRequired)
|
||||
{
|
||||
_resourcePackNoResponse.put(player.getName(), System.currentTimeMillis());
|
||||
}
|
||||
|
||||
_resourcePackUsers.put(player.getName(), null);
|
||||
player.setResourcePack(_resourcePackUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,11 +8,10 @@ public enum GameType
|
||||
BaconBrawl("Bacon Brawl", Material.PORK, (byte)0, GameCategory.ARCADE, 1),
|
||||
Barbarians("A Barbarians Life", Material.WOOD_AXE, (byte)0, GameCategory.ARCADE, 2),
|
||||
Bridge("The Bridges", Material.IRON_PICKAXE, (byte)0, GameCategory.SURVIVAL, 3),
|
||||
|
||||
CastleSiege("Castle Siege", Material.DIAMOND_CHESTPLATE, (byte)0, GameCategory.CLASSICS, 4),
|
||||
ChampionsTDM("Champions TDM", "Champions", Material.GOLD_SWORD, (byte)0, GameCategory.CHAMPIONS, 5),
|
||||
ChampionsDominate("Champions Domination", "Champions", Material.BEACON, (byte)0, GameCategory.CHAMPIONS, 6),
|
||||
ChampionsMOBA("Champions MOBA", "Champions", Material.SKULL_ITEM, (byte)0, GameCategory.CHAMPIONS, 7),
|
||||
ChampionsTDM("Champions TDM", "Champions", Material.GOLD_SWORD, (byte)0, GameCategory.CHAMPIONS, 5),
|
||||
Christmas("Christmas Chaos", Material.SNOW_BALL, (byte)0, GameCategory.CLASSICS, 8),
|
||||
DeathTag("Death Tag", Material.SKULL_ITEM, (byte)0, GameCategory.ARCADE, 9),
|
||||
DragonEscape("Dragon Escape", Material.DRAGON_EGG, (byte)0, GameCategory.ARCADE, 10),
|
||||
@ -27,12 +26,10 @@ public enum GameType
|
||||
Halloween("Halloween Horror", Material.PUMPKIN, (byte)0, GameCategory.CLASSICS, 19),
|
||||
HideSeek("Block Hunt", Material.GRASS, (byte)0, GameCategory.CLASSICS, 20),
|
||||
Horse("Horseback", Material.IRON_BARDING, (byte)0, GameCategory.ARCADE, 21),
|
||||
SurvivalGames("Survival Games", Material.IRON_SWORD, (byte)0, GameCategory.SURVIVAL, 22),
|
||||
SurvivalGamesTeams("Survival Games Teams", Material.IRON_SWORD, (byte)0, GameCategory.SURVIVAL, 23),
|
||||
Micro("Micro Battle", Material.LAVA_BUCKET, (byte)0, GameCategory.ARCADE, 24),
|
||||
MineStrike("MineStrike", Material.TNT, (byte)0, GameCategory.CLASSICS, 25),
|
||||
MineWare("MineWare", Material.PAPER, (byte)0, GameCategory.ARCADE, 26),
|
||||
MilkCow("Milk the Cow", Material.MILK_BUCKET, (byte)0, GameCategory.ARCADE, 27),
|
||||
MineStrike("MineStrike", Material.TNT, (byte)0, GameCategory.CLASSICS, 25, "http://chivebox.com/file/c/assets.zip", false),
|
||||
MineWare("MineWare", Material.PAPER, (byte)0, GameCategory.ARCADE, 26),
|
||||
Paintball("Super Paintball", Material.ENDER_PEARL, (byte)0, GameCategory.ARCADE, 28),
|
||||
Quiver("One in the Quiver", Material.ARROW, (byte)0, GameCategory.ARCADE, 29),
|
||||
QuiverTeams("One in the Quiver Teams", Material.ARROW, (byte)0, GameCategory.ARCADE, 30),
|
||||
@ -40,24 +37,25 @@ public enum GameType
|
||||
SearchAndDestroy("Search and Destroy", Material.TNT, (byte)0, GameCategory.SURVIVAL, 32),
|
||||
Sheep("Sheep Quest", Material.WOOL, (byte)4, GameCategory.ARCADE, 33),
|
||||
Smash("Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.CLASSICS, 34),
|
||||
SmashTeams("Super Smash Mobs Teams", "Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.CLASSICS, 35),
|
||||
SmashDomination("Super Smash Mobs Domination", "Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.CLASSICS, 36),
|
||||
SmashTeams("Super Smash Mobs Teams", "Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.CLASSICS, 35),
|
||||
Snake("Snake", Material.WOOL, (byte)0, GameCategory.ARCADE, 37),
|
||||
SneakyAssassins("Sneaky Assassins", Material.INK_SACK, (byte)0, GameCategory.ARCADE, 38),
|
||||
SnowFight("Snow Fight", Material.SNOW_BALL, (byte)0, GameCategory.ARCADE, 39),
|
||||
Spleef("Super Spleef", Material.IRON_SPADE, (byte)0, GameCategory.ARCADE, 40),
|
||||
SpleefTeams("Super Spleef Teams", Material.IRON_SPADE, (byte)0, GameCategory.ARCADE, 41),
|
||||
Stacker("Super Stacker", Material.BOWL, (byte)0, GameCategory.ARCADE, 42),
|
||||
SquidShooter("Squid Shooter", Material.FIREWORK_CHARGE, (byte)0, GameCategory.ARCADE, 43),
|
||||
Stacker("Super Stacker", Material.BOWL, (byte)0, GameCategory.ARCADE, 42),
|
||||
SurvivalGames("Survival Games", Material.IRON_SWORD, (byte)0, GameCategory.SURVIVAL, 22),
|
||||
SurvivalGamesTeams("Survival Games Teams", Material.IRON_SWORD, (byte)0, GameCategory.SURVIVAL, 23),
|
||||
Tug("Tug of Wool", Material.WHEAT, (byte)0, GameCategory.ARCADE, 44),
|
||||
TurfWars("Turf Wars", Material.STAINED_CLAY, (byte)14, GameCategory.ARCADE, 45),
|
||||
UHC("Ultra Hardcore", Material.GOLDEN_APPLE, (byte)0, GameCategory.SURVIVAL, 46),
|
||||
WitherAssault("Wither Assault", Material.SKULL_ITEM, (byte)1, GameCategory.ARCADE, 47),
|
||||
Wizards("Wizards", Material.BLAZE_ROD, (byte)0, GameCategory.SURVIVAL, 48),
|
||||
Wizards("Wizards", Material.BLAZE_ROD, (byte)0, GameCategory.SURVIVAL, 48, "http://chivebox.com/file/c/ResWizards.zip", true),
|
||||
ZombieSurvival("Zombie Survival", Material.SKULL_ITEM, (byte)2, GameCategory.SURVIVAL, 49),
|
||||
|
||||
Build("Master Builders", Material.BRICK, (byte)0, GameCategory.CLASSICS, 50),
|
||||
|
||||
|
||||
Event("Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999);
|
||||
|
||||
String _name;
|
||||
@ -65,6 +63,8 @@ public enum GameType
|
||||
Material _mat;
|
||||
byte _data;
|
||||
GameCategory _gameCategory;
|
||||
boolean _enforceResourcePack;
|
||||
String _resourcePack;
|
||||
|
||||
private int _gameId; // Unique identifying id for this gamemode (used for statistics)
|
||||
public int getGameId() { return _gameId; }
|
||||
@ -73,8 +73,18 @@ public enum GameType
|
||||
{
|
||||
this(name, name, mat, data, gameCategory, gameId);
|
||||
}
|
||||
|
||||
|
||||
GameType(String name, Material mat, byte data, GameCategory gameCategory, int gameId, String resourcePackUrl, boolean enforceResourcePack)
|
||||
{
|
||||
this(name, name, mat, data, gameCategory, gameId, resourcePackUrl, enforceResourcePack);
|
||||
}
|
||||
|
||||
GameType(String name, String lobbyName, Material mat, byte data, GameCategory gameCategory, int gameId)
|
||||
{
|
||||
this(name, lobbyName, mat, data, gameCategory, gameId, null, false);
|
||||
}
|
||||
|
||||
GameType(String name, String lobbyName, Material mat, byte data, GameCategory gameCategory, int gameId, String resourcePackUrl, boolean enforceResourcePack)
|
||||
{
|
||||
_name = name;
|
||||
_lobbyName = lobbyName;
|
||||
@ -82,6 +92,18 @@ public enum GameType
|
||||
_data = data;
|
||||
_gameCategory = gameCategory;
|
||||
_gameId = gameId;
|
||||
_resourcePack = resourcePackUrl;
|
||||
_enforceResourcePack = enforceResourcePack;
|
||||
}
|
||||
|
||||
public boolean isEnforceResourcePack()
|
||||
{
|
||||
return _enforceResourcePack;
|
||||
}
|
||||
|
||||
public String getResourcePackUrl()
|
||||
{
|
||||
return _resourcePack;
|
||||
}
|
||||
|
||||
public String GetName()
|
||||
|
@ -316,6 +316,8 @@ public abstract class Game implements Listener
|
||||
new TeamKillsStatTracker(this)
|
||||
);
|
||||
}
|
||||
|
||||
Manager.setResourcePack(gameType.getResourcePackUrl(), gameType.isEnforceResourcePack());
|
||||
|
||||
System.out.println("Loading " + GetName() + "...");
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ public class Build extends SoloGame
|
||||
|
||||
_word = _words[UtilMath.r(_words.length)];
|
||||
|
||||
UtilTextMiddle.display(null, C.cYellow + "Build " + C.cWhite + _word, 5, 80, 5);
|
||||
UtilTextMiddle.display(null, C.cYellow + "Build " + C.cWhite + _word, 0, 80, 5);
|
||||
}
|
||||
}
|
||||
|
||||
@ -177,7 +177,7 @@ public class Build extends SoloGame
|
||||
|
||||
this.InventoryClick = false;
|
||||
|
||||
UtilTextMiddle.display(null, C.cYellow + "Time Up!", 5, 60, 5);
|
||||
UtilTextMiddle.display(null, C.cYellow + "Time Up!", 0, 60, 5);
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
player.getInventory().clear(8);
|
||||
@ -217,7 +217,7 @@ public class Build extends SoloGame
|
||||
}
|
||||
|
||||
//Announce Builder
|
||||
UtilTextMiddle.display(quality.getText(), "Built by: " + C.Bold + _viewData.Player.getName(), 5, 60, 5);
|
||||
UtilTextMiddle.display(quality.getText(), "Built by: " + C.Bold + _viewData.Player.getName(), 0, 80, 5);
|
||||
}
|
||||
|
||||
_viewData.Judged = true;
|
||||
@ -267,7 +267,7 @@ public class Build extends SoloGame
|
||||
}
|
||||
|
||||
//Text
|
||||
UtilTextMiddle.display(null, C.cYellow + "Cast Your Vote!", 5, 60, 5);
|
||||
UtilTextMiddle.display(null, C.cYellow + "Cast Your Vote!", 0, 60, 5);
|
||||
|
||||
_buildStateTime = System.currentTimeMillis();
|
||||
}
|
||||
@ -366,7 +366,7 @@ public class Build extends SoloGame
|
||||
|
||||
private BuildQuality getQuality(double score)
|
||||
{
|
||||
return BuildQuality.getQuality(score / ((double)GetPlayers(true).size()-1 * 1.5d));
|
||||
return BuildQuality.getQuality(score / (double)(GetPlayers(true).size()-1));
|
||||
}
|
||||
|
||||
public BuildData getBuildData(Player player)
|
||||
@ -494,27 +494,27 @@ public class Build extends SoloGame
|
||||
{
|
||||
case 14:
|
||||
_viewData.addScore(event.getPlayer(), 0);
|
||||
UtilTextMiddle.display(null, event.getPlayer().getItemInHand().getItemMeta().getDisplayName(), 5, 40, 5, event.getPlayer());
|
||||
UtilTextMiddle.display(null, event.getPlayer().getItemInHand().getItemMeta().getDisplayName(), 0, 40, 5, event.getPlayer());
|
||||
break;
|
||||
case 1:
|
||||
_viewData.addScore(event.getPlayer(), 1);
|
||||
UtilTextMiddle.display(null, event.getPlayer().getItemInHand().getItemMeta().getDisplayName(), 5, 40, 5, event.getPlayer());
|
||||
UtilTextMiddle.display(null, event.getPlayer().getItemInHand().getItemMeta().getDisplayName(), 0, 40, 5, event.getPlayer());
|
||||
break;
|
||||
case 4:
|
||||
_viewData.addScore(event.getPlayer(), 2);
|
||||
UtilTextMiddle.display(null, event.getPlayer().getItemInHand().getItemMeta().getDisplayName(), 5, 40, 5, event.getPlayer());
|
||||
UtilTextMiddle.display(null, event.getPlayer().getItemInHand().getItemMeta().getDisplayName(), 0, 40, 5, event.getPlayer());
|
||||
break;
|
||||
case 5:
|
||||
_viewData.addScore(event.getPlayer(), 3);
|
||||
UtilTextMiddle.display(null, event.getPlayer().getItemInHand().getItemMeta().getDisplayName(), 5, 40, 5, event.getPlayer());
|
||||
UtilTextMiddle.display(null, event.getPlayer().getItemInHand().getItemMeta().getDisplayName(), 0, 40, 5, event.getPlayer());
|
||||
break;
|
||||
case 3:
|
||||
_viewData.addScore(event.getPlayer(), 4);
|
||||
UtilTextMiddle.display(null, event.getPlayer().getItemInHand().getItemMeta().getDisplayName(), 5, 40, 5, event.getPlayer());
|
||||
UtilTextMiddle.display(null, event.getPlayer().getItemInHand().getItemMeta().getDisplayName(), 0, 40, 5, event.getPlayer());
|
||||
break;
|
||||
case 10:
|
||||
_viewData.addScore(event.getPlayer(), 5);
|
||||
UtilTextMiddle.display(null, event.getPlayer().getItemInHand().getItemMeta().getDisplayName(), 5, 40, 5, event.getPlayer());
|
||||
UtilTextMiddle.display(null, event.getPlayer().getItemInHand().getItemMeta().getDisplayName(), 0, 40, 5, event.getPlayer());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -580,8 +580,6 @@ public class Build extends SoloGame
|
||||
for (Block block : event.getBlocks())
|
||||
if (!data.inBuildArea(block))
|
||||
{
|
||||
event.getBlock().getWorld().playSound(event.getBlock().getLocation(), Sound.PISTON_EXTEND, 2f, 0.5f);
|
||||
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, block.getLocation().add(0.5, 0.5, 0.5), 0, 0, 0, 0, 1);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -593,8 +591,6 @@ public class Build extends SoloGame
|
||||
for (BuildData data : _data.values())
|
||||
if (!data.inBuildArea(event.getBlock()))
|
||||
{
|
||||
event.getBlock().getWorld().playSound(event.getBlock().getLocation(), Sound.PISTON_RETRACT, 2f, 0.5f);
|
||||
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, event.getBlock().getLocation().add(0.5, 0.5, 0.5), 0, 0, 0, 0, 1);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -635,7 +631,7 @@ public class Build extends SoloGame
|
||||
Scoreboard.WriteBlank();
|
||||
|
||||
Scoreboard.Write(C.cYellow + C.Bold + "Votes Cast");
|
||||
Scoreboard.Write(_viewData.Score.size() + " / " + GetPlayers(true).size());
|
||||
Scoreboard.Write(_viewData.Score.size() + " / " + (GetPlayers(true).size()-1));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ public class Draw extends SoloGame
|
||||
|
||||
_words = new String[]
|
||||
{
|
||||
"Bird", "Volcano", "Love", "Dance", "Hair", "Glasses", "Domino", "Dice", "Computer", "Top Hat", "Beard", "Wind", "Rain", "Minecraft", "Push", "Fighting", "Juggle", "Clown", "Miner", "Creeper", "Ghast", "Spider", "Punch", "Roll", "River", "Desert", "Cold", "Pregnant", "Photo", "Quick", "Mario", "Luigi", "Bridge", "Turtle", "Door Knob", "Mineplex", "Binoculars", "Telescope", "Planet", "Mountain Bike", "Moon", "Comet", "Flower", "Squirrel", "Horse Riding", "Chef", "Elephant", "Yoshi", "Shotgun", "Pistol", "James Bond", "Money", "Salt and Pepper", "Truck", "Helicopter", "Hot Air Balloon", "Sprout", "Yelling", "Muscles", "Skinny", "Zombie", "Lava", "Snake", "Motorbike", "Whale", "Boat", "Letterbox", "Window", "Lollipop", "Handcuffs", "Police", "Uppercut", "Windmill", "Eyepatch", "Campfire", "Rainbow", "Storm", "Pikachu", "Charmander", "Tornado", "Crying", "King", "Hobo", "Worm", "Snail", "XBox", "Playstation", "Nintendo", "Duck", "Pull", "Dinosaur", "Alligator", "Ankle", "Angel", "Acorn", "Bread", "Booty", "Bacon", "Crown", "Donut", "Drill", "Leash", "Magic", "Wizard", "Igloo", "Plant", "Screw", "Rifle", "Puppy", "Stool", "Stamp", "Letter", "Witch", "Zebra", "Wagon", "Compass", "Watch", "Clock", "Time", "Cyclops", "Coconut", "Hang", "Penguin", "Confused", "Bucket", "Lion", "Rubbish", "Spaceship", "Bowl", "Shark", "Pizza", "Pyramid", "Dress", "Pants", "Shorts", "Boots", "Boy", "Girl", "Math", "Sunglasses", "Frog", "Chair", "Cake", "Grapes", "Kiss", "Snorlax", "Earth", "Spaghetti", "Couch", "Family", "Milk", "Blood", "Pig", "Giraffe", "Mouse", "Couch", "Fat", "Chocolate", "Camel", "Cheese", "Beans", "Water", "Chicken", "Cannibal", "Zipper", "Book", "Swimming", "Horse", "Paper", "Toaster", "Television", "Hammer", "Piano", "Sleeping", "Yawn", "Sheep", "Night", "Chest", "Lamp", "Redstone", "Grass", "Plane", "Ocean", "Lake", "Melon", "Pumpkin", "Gift", "Fishing", "Pirate", "Lightning", "Stomach", "Belly Button", "Fishing Rod", "Iron Ore", "Diamonds", "Emeralds", "Nether Portal", "Ender Dragon", "Rabbit", "Harry Potter", "Torch", "Light", "Battery", "Zombie Pigman", "Telephone", "Tent", "Hand", "Traffic Lights", "Anvil", "Tail", "Umbrella", "Piston", "Skeleton", "Spikes", "Bridge", "Bomb", "Spoon", "Rainbow", "Staircase", "Poop", "Dragon", "Fire", "Apple", "Shoe", "Squid", "Cookie", "Tooth", "Camera", "Sock", "Monkey", "Unicorn", "Smile", "Pool", "Rabbit", "Cupcake", "Pancake", "Princess", "Castle", "Flag", "Planet", "Stars", "Camp Fire", "Rose", "Spray", "Pencil", "Ice Cream", "Toilet", "Moose", "Bear", "Beer", "Batman", "Eggs", "Teapot", "Golf Club", "Tennis Racket", "Shield", "Crab", "Pot of Gold", "Cactus", "Television", "Pumpkin Pie", "Chimney", "Stable", "Nether", "Wither", "Beach", "Stop Sign", "Chestplate", "Pokeball", "Christmas Tree", "Present", "Snowflake", "Laptop", "Superman", "Football", "Basketball", "Creeper", "Tetris", "Jump", "Ninja", "Baby", "Troll Face", "Grim Reaper", "Temple", "Explosion", "Vomit", "Ants", "Barn", "Burn", "Baggage", "Frisbee", "Iceberg", "Sleeping", "Dream", "Snorlax", "Balloons", "Elevator", "Alligator", "Bikini", "Butterfly", "Bumblebee", "Pizza", "Jellyfish", "Sideburns", "Speedboat", "Treehouse", "Water Gun", "Drink", "Hook", "Dance", "Fall", "Summer", "Autumn", "Spring", "Winter", "Night Time", "Galaxy", "Sunrise", "Sunset", "Picnic", "Snowflake", "Holding Hands", "America", "Laptop", "Anvil", "Bagel", "Bench", "Cigar", "Darts", "Muffin", "Queen", "Wheat", "Dolphin", "Scarf", "Swing", "Thumb", "Tomato", "Alcohol", "Armor", "Alien", "Beans", "Cheek", "Phone", "Keyboard", "Orange", "Calculator", "Paper", "Desk", "Disco", "Elbow", "Drool", "Giant", "Golem", "Grave", "Llama", "Moose", "Party", "Panda", "Plumber", "Salsa", "Salad", "Skunk", "Skull", "Stump", "Sugar", "Ruler", "Bookcase", "Hamster", "Soup", "Teapot", "Towel", "Waist", "Archer", "Anchor", "Bamboo", "Branch", "Booger", "Carrot", "Cereal", "Coffee", "Wolf", "Crayon", "Finger", "Forest", "Hotdog", "Burger", "Obsidian", "Pillow", "Swing", "YouTube", "Farm", "Rain", "Cloud", "Frozen", "Garbage", "Music", "Twitter", "Facebook", "Santa Hat", "Rope", "Neck", "Sponge", "Sushi", "Noodles", "Soup", "Tower", "Berry", "Capture", "Prison", "Robot", "Trash", "School", "Skype", "Snowman", "Crowd", "Bank", "Mudkip", "Joker", "Lizard", "Tiger", "Royal", "Erupt", "Wizard", "Stain", "Cinema", "Notebook", "Blanket", "Paint", "Guard", "Astronaut" , "Slime" , "Mansion" , "Radar" , "Thorn" , "Tears" , "Tiny" , "Candy" , "Pepsi" , "Flint" , "Draw My Thing" , "Rice" , "Shout" , "Prize" , "Skirt" , "Thief" , "Syrup" , "Kirby" , "Brush" , "Violin",
|
||||
"Bird", "Volcano", "Sloth", "Love", "Dance", "Hair", "Glasses", "Domino", "Dice", "Computer", "Top Hat", "Beard", "Wind", "Rain", "Minecraft", "Push", "Fighting", "Juggle", "Clown", "Miner", "Creeper", "Ghast", "Spider", "Punch", "Roll", "River", "Desert", "Cold", "Pregnant", "Photo", "Quick", "Mario", "Luigi", "Bridge", "Turtle", "Door Knob", "Mineplex", "Binoculars", "Telescope", "Planet", "Mountain Bike", "Moon", "Comet", "Flower", "Squirrel", "Horse Riding", "Chef", "Elephant", "Yoshi", "Shotgun", "Pistol", "James Bond", "Money", "Salt and Pepper", "Truck", "Helicopter", "Hot Air Balloon", "Sprout", "Yelling", "Muscles", "Skinny", "Zombie", "Lava", "Snake", "Motorbike", "Whale", "Boat", "Letterbox", "Window", "Lollipop", "Handcuffs", "Police", "Uppercut", "Windmill", "Eyepatch", "Campfire", "Rainbow", "Storm", "Pikachu", "Charmander", "Tornado", "Crying", "King", "Hobo", "Worm", "Snail", "XBox", "Playstation", "Nintendo", "Duck", "Pull", "Dinosaur", "Alligator", "Ankle", "Angel", "Acorn", "Bread", "Booty", "Bacon", "Crown", "Donut", "Drill", "Leash", "Magic", "Wizard", "Igloo", "Plant", "Screw", "Rifle", "Puppy", "Stool", "Stamp", "Letter", "Witch", "Zebra", "Wagon", "Compass", "Watch", "Clock", "Time", "Cyclops", "Coconut", "Hang", "Penguin", "Confused", "Bucket", "Lion", "Rubbish", "Spaceship", "Bowl", "Shark", "Pizza", "Pyramid", "Dress", "Pants", "Shorts", "Boots", "Boy", "Girl", "Math", "Sunglasses", "Frog", "Chair", "Cake", "Grapes", "Kiss", "Snorlax", "Earth", "Spaghetti", "Couch", "Family", "Milk", "Blood", "Pig", "Giraffe", "Mouse", "Couch", "Fat", "Chocolate", "Camel", "Cheese", "Beans", "Water", "Chicken", "Cannibal", "Zipper", "Book", "Swimming", "Horse", "Paper", "Toaster", "Television", "Hammer", "Piano", "Sleeping", "Yawn", "Sheep", "Night", "Chest", "Lamp", "Redstone", "Grass", "Plane", "Ocean", "Lake", "Melon", "Pumpkin", "Gift", "Fishing", "Pirate", "Lightning", "Stomach", "Belly Button", "Fishing Rod", "Iron Ore", "Diamonds", "Emeralds", "Nether Portal", "Ender Dragon", "Rabbit", "Harry Potter", "Torch", "Light", "Battery", "Zombie Pigman", "Telephone", "Tent", "Hand", "Traffic Lights", "Anvil", "Tail", "Umbrella", "Piston", "Skeleton", "Spikes", "Bridge", "Bomb", "Spoon", "Rainbow", "Staircase", "Poop", "Dragon", "Fire", "Apple", "Shoe", "Squid", "Cookie", "Tooth", "Camera", "Sock", "Monkey", "Unicorn", "Smile", "Pool", "Rabbit", "Cupcake", "Pancake", "Princess", "Castle", "Flag", "Planet", "Stars", "Camp Fire", "Rose", "Spray", "Pencil", "Ice Cream", "Toilet", "Moose", "Bear", "Beer", "Batman", "Eggs", "Teapot", "Golf Club", "Tennis Racket", "Shield", "Crab", "Pot of Gold", "Cactus", "Television", "Pumpkin Pie", "Chimney", "Stable", "Nether", "Wither", "Beach", "Stop Sign", "Chestplate", "Pokeball", "Christmas Tree", "Present", "Snowflake", "Laptop", "Superman", "Football", "Basketball", "Creeper", "Tetris", "Jump", "Ninja", "Baby", "Troll Face", "Grim Reaper", "Temple", "Explosion", "Vomit", "Ants", "Barn", "Burn", "Baggage", "Frisbee", "Iceberg", "Sleeping", "Dream", "Snorlax", "Balloons", "Elevator", "Alligator", "Bikini", "Butterfly", "Bumblebee", "Pizza", "Jellyfish", "Sideburns", "Speedboat", "Treehouse", "Water Gun", "Drink", "Hook", "Dance", "Fall", "Summer", "Autumn", "Spring", "Winter", "Night Time", "Galaxy", "Sunrise", "Sunset", "Picnic", "Snowflake", "Holding Hands", "America", "Laptop", "Anvil", "Bagel", "Bench", "Cigar", "Darts", "Muffin", "Queen", "Wheat", "Dolphin", "Scarf", "Swing", "Thumb", "Tomato", "Alcohol", "Armor", "Alien", "Beans", "Cheek", "Phone", "Keyboard", "Orange", "Calculator", "Paper", "Desk", "Disco", "Elbow", "Drool", "Giant", "Golem", "Grave", "Llama", "Moose", "Party", "Panda", "Plumber", "Salsa", "Salad", "Skunk", "Skull", "Stump", "Sugar", "Ruler", "Bookcase", "Hamster", "Soup", "Teapot", "Towel", "Waist", "Archer", "Anchor", "Bamboo", "Branch", "Booger", "Carrot", "Cereal", "Coffee", "Wolf", "Crayon", "Finger", "Forest", "Hotdog", "Burger", "Obsidian", "Pillow", "Swing", "YouTube", "Farm", "Rain", "Cloud", "Frozen", "Garbage", "Music", "Twitter", "Facebook", "Santa Hat", "Rope", "Neck", "Sponge", "Sushi", "Noodles", "Soup", "Tower", "Berry", "Capture", "Prison", "Robot", "Trash", "School", "Skype", "Snowman", "Crowd", "Bank", "Mudkip", "Joker", "Lizard", "Tiger", "Royal", "Erupt", "Wizard", "Stain", "Cinema", "Notebook", "Blanket", "Paint", "Guard", "Astronaut" , "Slime" , "Mansion" , "Radar" , "Thorn" , "Tears" , "Tiny" , "Candy" , "Pepsi" , "Flint" , "Draw My Thing" , "Rice" , "Shout" , "Prize" , "Skirt" , "Thief" , "Syrup" , "Kirby" , "Brush" , "Violin",
|
||||
};
|
||||
|
||||
_tools = new HashSet<Tool>();
|
||||
|
@ -1844,129 +1844,129 @@ public class SurvivalGames extends SoloGame
|
||||
private void setupLoot()
|
||||
{
|
||||
// Food
|
||||
_baseLoot.registerLoot(new RandomItem(Material.BAKED_POTATO, 30, 1, 3));
|
||||
_baseLoot.registerLoot(new RandomItem(Material.COOKED_BEEF, 30, 1, 2));
|
||||
_baseLoot.registerLoot(new RandomItem(Material.COOKED_CHICKEN, 30, 1, 2));
|
||||
_baseLoot.registerLoot(new RandomItem(Material.CARROT_ITEM, 30, 1, 3));
|
||||
_baseLoot.registerLoot(new RandomItem(Material.MUSHROOM_SOUP, 15, 1, 1));
|
||||
_baseLoot.registerLoot(new RandomItem(Material.WHEAT, 30, 1, 6));
|
||||
_baseLoot.registerLoot(new RandomItem(Material.APPLE, 30, 1, 4));
|
||||
_baseLoot.registerLoot(new RandomItem(Material.PORK, 30, 1, 4));
|
||||
_baseLoot.registerLoot(new RandomItem(Material.ROTTEN_FLESH, 40, 1, 6));
|
||||
_baseLoot.addLoot(new RandomItem(Material.BAKED_POTATO, 30, 1, 3));
|
||||
_baseLoot.addLoot(new RandomItem(Material.COOKED_BEEF, 30, 1, 2));
|
||||
_baseLoot.addLoot(new RandomItem(Material.COOKED_CHICKEN, 30, 1, 2));
|
||||
_baseLoot.addLoot(new RandomItem(Material.CARROT_ITEM, 30, 1, 3));
|
||||
_baseLoot.addLoot(new RandomItem(Material.MUSHROOM_SOUP, 15, 1, 1));
|
||||
_baseLoot.addLoot(new RandomItem(Material.WHEAT, 30, 1, 6));
|
||||
_baseLoot.addLoot(new RandomItem(Material.APPLE, 30, 1, 4));
|
||||
_baseLoot.addLoot(new RandomItem(Material.PORK, 30, 1, 4));
|
||||
_baseLoot.addLoot(new RandomItem(Material.ROTTEN_FLESH, 40, 1, 6));
|
||||
|
||||
// Weapons
|
||||
_baseLoot.registerLoot(new RandomItem(Material.WOOD_AXE, 80));
|
||||
_baseLoot.registerLoot(new RandomItem(Material.WOOD_SWORD, 70));
|
||||
_baseLoot.registerLoot(new RandomItem(Material.STONE_AXE, 60));
|
||||
_baseLoot.registerLoot(new RandomItem(Material.STONE_SWORD, 30));
|
||||
_baseLoot.addLoot(new RandomItem(Material.WOOD_AXE, 80));
|
||||
_baseLoot.addLoot(new RandomItem(Material.WOOD_SWORD, 70));
|
||||
_baseLoot.addLoot(new RandomItem(Material.STONE_AXE, 60));
|
||||
_baseLoot.addLoot(new RandomItem(Material.STONE_SWORD, 30));
|
||||
|
||||
// Leather armor
|
||||
_baseLoot.registerLoot(new RandomItem(Material.LEATHER_BOOTS, 30));
|
||||
_baseLoot.registerLoot(new RandomItem(Material.LEATHER_CHESTPLATE, 30));
|
||||
_baseLoot.registerLoot(new RandomItem(Material.LEATHER_HELMET, 30));
|
||||
_baseLoot.registerLoot(new RandomItem(Material.LEATHER_LEGGINGS, 30));
|
||||
_baseLoot.addLoot(new RandomItem(Material.LEATHER_BOOTS, 30));
|
||||
_baseLoot.addLoot(new RandomItem(Material.LEATHER_CHESTPLATE, 30));
|
||||
_baseLoot.addLoot(new RandomItem(Material.LEATHER_HELMET, 30));
|
||||
_baseLoot.addLoot(new RandomItem(Material.LEATHER_LEGGINGS, 30));
|
||||
|
||||
// Gold armor
|
||||
_baseLoot.registerLoot(new RandomItem(Material.GOLD_BOOTS, 25));
|
||||
_baseLoot.registerLoot(new RandomItem(Material.GOLD_CHESTPLATE, 25));
|
||||
_baseLoot.registerLoot(new RandomItem(Material.GOLD_HELMET, 25));
|
||||
_baseLoot.registerLoot(new RandomItem(Material.GOLD_LEGGINGS, 25));
|
||||
_baseLoot.addLoot(new RandomItem(Material.GOLD_BOOTS, 25));
|
||||
_baseLoot.addLoot(new RandomItem(Material.GOLD_CHESTPLATE, 25));
|
||||
_baseLoot.addLoot(new RandomItem(Material.GOLD_HELMET, 25));
|
||||
_baseLoot.addLoot(new RandomItem(Material.GOLD_LEGGINGS, 25));
|
||||
|
||||
// Chain armor
|
||||
_baseLoot.registerLoot(new RandomItem(Material.CHAINMAIL_BOOTS, 20));
|
||||
_baseLoot.registerLoot(new RandomItem(Material.CHAINMAIL_CHESTPLATE, 20));
|
||||
_baseLoot.registerLoot(new RandomItem(Material.CHAINMAIL_HELMET, 20));
|
||||
_baseLoot.registerLoot(new RandomItem(Material.CHAINMAIL_LEGGINGS, 20));
|
||||
_baseLoot.addLoot(new RandomItem(Material.CHAINMAIL_BOOTS, 20));
|
||||
_baseLoot.addLoot(new RandomItem(Material.CHAINMAIL_CHESTPLATE, 20));
|
||||
_baseLoot.addLoot(new RandomItem(Material.CHAINMAIL_HELMET, 20));
|
||||
_baseLoot.addLoot(new RandomItem(Material.CHAINMAIL_LEGGINGS, 20));
|
||||
|
||||
// Throwable
|
||||
_baseLoot.registerLoot(new RandomItem(Material.FISHING_ROD, 30));
|
||||
_baseLoot.registerLoot(new RandomItem(Material.BOW, 20));
|
||||
_baseLoot.registerLoot(new RandomItem(Material.ARROW, 20, 1, 3));
|
||||
_baseLoot.registerLoot(new RandomItem(Material.SNOW_BALL, 30, 1, 2));
|
||||
_baseLoot.registerLoot(new RandomItem(Material.EGG, 30, 1, 2));
|
||||
_baseLoot.addLoot(new RandomItem(Material.FISHING_ROD, 30));
|
||||
_baseLoot.addLoot(new RandomItem(Material.BOW, 20));
|
||||
_baseLoot.addLoot(new RandomItem(Material.ARROW, 20, 1, 3));
|
||||
_baseLoot.addLoot(new RandomItem(Material.SNOW_BALL, 30, 1, 2));
|
||||
_baseLoot.addLoot(new RandomItem(Material.EGG, 30, 1, 2));
|
||||
|
||||
// Misc
|
||||
_baseLoot.registerLoot(new RandomItem(Material.EXP_BOTTLE, 30, 1, 2));
|
||||
_baseLoot.registerLoot(new RandomItem(Material.COMPASS, 20));
|
||||
_baseLoot.registerLoot(new RandomItem(Material.STICK, 30, 1, 2));
|
||||
_baseLoot.registerLoot(new RandomItem(Material.BOAT, 15));
|
||||
_baseLoot.registerLoot(new RandomItem(Material.FLINT, 30, 1, 2));
|
||||
_baseLoot.registerLoot(new RandomItem(Material.FEATHER, 30, 1, 2));
|
||||
_baseLoot.registerLoot(new RandomItem(Material.GOLD_INGOT, 20));
|
||||
_baseLoot.registerLoot(new RandomItem(ItemStackFactory.Instance.CreateStack(Material.TNT, (byte)0, 1, F.item("Throwing TNT")), 15));
|
||||
_spawnLoot.registerLoot(new RandomItem(Material.MUSHROOM_SOUP, 15));
|
||||
_baseLoot.addLoot(new RandomItem(Material.EXP_BOTTLE, 30, 1, 2));
|
||||
_baseLoot.addLoot(new RandomItem(Material.COMPASS, 20));
|
||||
_baseLoot.addLoot(new RandomItem(Material.STICK, 30, 1, 2));
|
||||
_baseLoot.addLoot(new RandomItem(Material.BOAT, 15));
|
||||
_baseLoot.addLoot(new RandomItem(Material.FLINT, 30, 1, 2));
|
||||
_baseLoot.addLoot(new RandomItem(Material.FEATHER, 30, 1, 2));
|
||||
_baseLoot.addLoot(new RandomItem(Material.GOLD_INGOT, 20));
|
||||
_baseLoot.addLoot(new RandomItem(ItemStackFactory.Instance.CreateStack(Material.TNT, (byte)0, 1, F.item("Throwing TNT")), 15));
|
||||
_spawnLoot.addLoot(new RandomItem(Material.MUSHROOM_SOUP, 15));
|
||||
|
||||
_spawnLoot.cloneLoot(_baseLoot);
|
||||
|
||||
// Food
|
||||
_spawnLoot.registerLoot(new RandomItem(Material.BAKED_POTATO, 30, 1, 5));
|
||||
_spawnLoot.registerLoot(new RandomItem(Material.CAKE, 30));
|
||||
_spawnLoot.registerLoot(new RandomItem(Material.MUSHROOM_SOUP, 30, 1, 1));
|
||||
_spawnLoot.registerLoot(new RandomItem(Material.COOKED_BEEF, 30, 1, 3));
|
||||
_spawnLoot.registerLoot(new RandomItem(Material.COOKED_CHICKEN, 30, 1, 3));
|
||||
_spawnLoot.registerLoot(new RandomItem(Material.COOKED_FISH, 30, 1, 6));
|
||||
_spawnLoot.registerLoot(new RandomItem(Material.GRILLED_PORK, 30, 1, 3));
|
||||
_spawnLoot.registerLoot(new RandomItem(Material.COOKIE, 30));
|
||||
_spawnLoot.registerLoot(new RandomItem(Material.PUMPKIN_PIE, 30, 1, 3));
|
||||
_spawnLoot.registerLoot(new RandomItem(Material.APPLE, 30, 2, 6));
|
||||
_spawnLoot.addLoot(new RandomItem(Material.BAKED_POTATO, 30, 1, 5));
|
||||
_spawnLoot.addLoot(new RandomItem(Material.CAKE, 30));
|
||||
_spawnLoot.addLoot(new RandomItem(Material.MUSHROOM_SOUP, 30, 1, 1));
|
||||
_spawnLoot.addLoot(new RandomItem(Material.COOKED_BEEF, 30, 1, 3));
|
||||
_spawnLoot.addLoot(new RandomItem(Material.COOKED_CHICKEN, 30, 1, 3));
|
||||
_spawnLoot.addLoot(new RandomItem(Material.COOKED_FISH, 30, 1, 6));
|
||||
_spawnLoot.addLoot(new RandomItem(Material.GRILLED_PORK, 30, 1, 3));
|
||||
_spawnLoot.addLoot(new RandomItem(Material.COOKIE, 30));
|
||||
_spawnLoot.addLoot(new RandomItem(Material.PUMPKIN_PIE, 30, 1, 3));
|
||||
_spawnLoot.addLoot(new RandomItem(Material.APPLE, 30, 2, 6));
|
||||
|
||||
// Loot for chests in spawn
|
||||
// Weaponry and ores
|
||||
_spawnLoot.registerLoot(new RandomItem(Material.STONE_SWORD, 30));
|
||||
_spawnLoot.registerLoot(new RandomItem(Material.IRON_AXE, 30));
|
||||
_spawnLoot.registerLoot(new RandomItem(Material.IRON_INGOT, 30, 1, 2));
|
||||
_spawnLoot.registerLoot(new RandomItem(Material.DIAMOND, 30));
|
||||
_spawnLoot.addLoot(new RandomItem(Material.STONE_SWORD, 30));
|
||||
_spawnLoot.addLoot(new RandomItem(Material.IRON_AXE, 30));
|
||||
_spawnLoot.addLoot(new RandomItem(Material.IRON_INGOT, 30, 1, 2));
|
||||
_spawnLoot.addLoot(new RandomItem(Material.DIAMOND, 30));
|
||||
|
||||
// Iron gear
|
||||
_spawnLoot.registerLoot(new RandomItem(Material.IRON_BOOTS, 30));
|
||||
_spawnLoot.registerLoot(new RandomItem(Material.IRON_CHESTPLATE, 30));
|
||||
_spawnLoot.registerLoot(new RandomItem(Material.IRON_HELMET, 30));
|
||||
_spawnLoot.registerLoot(new RandomItem(Material.IRON_LEGGINGS, 30));
|
||||
_spawnLoot.addLoot(new RandomItem(Material.IRON_BOOTS, 30));
|
||||
_spawnLoot.addLoot(new RandomItem(Material.IRON_CHESTPLATE, 30));
|
||||
_spawnLoot.addLoot(new RandomItem(Material.IRON_HELMET, 30));
|
||||
_spawnLoot.addLoot(new RandomItem(Material.IRON_LEGGINGS, 30));
|
||||
|
||||
// Supply crate loot
|
||||
// Diamond gear
|
||||
_crateLoot.registerLoot(new RandomItem(Material.DIAMOND_HELMET, 10));
|
||||
_crateLoot.registerLoot(new RandomItem(Material.DIAMOND_CHESTPLATE, 6));
|
||||
_crateLoot.registerLoot(new RandomItem(Material.DIAMOND_LEGGINGS, 8));
|
||||
_crateLoot.registerLoot(new RandomItem(Material.DIAMOND_BOOTS, 10));
|
||||
_crateLoot.addLoot(new RandomItem(Material.DIAMOND_HELMET, 10));
|
||||
_crateLoot.addLoot(new RandomItem(Material.DIAMOND_CHESTPLATE, 6));
|
||||
_crateLoot.addLoot(new RandomItem(Material.DIAMOND_LEGGINGS, 8));
|
||||
_crateLoot.addLoot(new RandomItem(Material.DIAMOND_BOOTS, 10));
|
||||
|
||||
// Iron gear
|
||||
_crateLoot.registerLoot(new RandomItem(Material.IRON_HELMET, 30));
|
||||
_crateLoot.registerLoot(new RandomItem(Material.IRON_CHESTPLATE, 24));
|
||||
_crateLoot.registerLoot(new RandomItem(Material.IRON_LEGGINGS, 27));
|
||||
_crateLoot.registerLoot(new RandomItem(Material.IRON_BOOTS, 30));
|
||||
_crateLoot.addLoot(new RandomItem(Material.IRON_HELMET, 30));
|
||||
_crateLoot.addLoot(new RandomItem(Material.IRON_CHESTPLATE, 24));
|
||||
_crateLoot.addLoot(new RandomItem(Material.IRON_LEGGINGS, 27));
|
||||
_crateLoot.addLoot(new RandomItem(Material.IRON_BOOTS, 30));
|
||||
|
||||
// Weapons
|
||||
_crateLoot.registerLoot(new RandomItem(Material.IRON_SWORD, 24));
|
||||
_crateLoot.registerLoot(new RandomItem(Material.DIAMOND_SWORD, 8));
|
||||
_crateLoot.registerLoot(new RandomItem(Material.DIAMOND_AXE, 16));
|
||||
_crateLoot.addLoot(new RandomItem(Material.IRON_SWORD, 24));
|
||||
_crateLoot.addLoot(new RandomItem(Material.DIAMOND_SWORD, 8));
|
||||
_crateLoot.addLoot(new RandomItem(Material.DIAMOND_AXE, 16));
|
||||
|
||||
// Cooked furnace
|
||||
_cookedFurnace.registerLoot(new RandomItem(Material.COOKED_BEEF, 3, 1, 2));
|
||||
_cookedFurnace.registerLoot(new RandomItem(Material.COOKED_CHICKEN, 3, 1, 2));
|
||||
_cookedFurnace.registerLoot(new RandomItem(Material.COOKED_FISH, 3, 1, 2));
|
||||
_cookedFurnace.registerLoot(new RandomItem(Material.GRILLED_PORK, 3, 1, 2));
|
||||
_cookedFurnace.registerLoot(new RandomItem(Material.BAKED_POTATO, 3, 1, 1));
|
||||
_cookedFurnace.registerLoot(new RandomItem(Material.PUMPKIN_PIE, 3, 1, 1));
|
||||
_cookedFurnace.registerLoot(new RandomItem(Material.IRON_INGOT, 1, 1, 1));
|
||||
_cookedFurnace.addLoot(new RandomItem(Material.COOKED_BEEF, 3, 1, 2));
|
||||
_cookedFurnace.addLoot(new RandomItem(Material.COOKED_CHICKEN, 3, 1, 2));
|
||||
_cookedFurnace.addLoot(new RandomItem(Material.COOKED_FISH, 3, 1, 2));
|
||||
_cookedFurnace.addLoot(new RandomItem(Material.GRILLED_PORK, 3, 1, 2));
|
||||
_cookedFurnace.addLoot(new RandomItem(Material.BAKED_POTATO, 3, 1, 1));
|
||||
_cookedFurnace.addLoot(new RandomItem(Material.PUMPKIN_PIE, 3, 1, 1));
|
||||
_cookedFurnace.addLoot(new RandomItem(Material.IRON_INGOT, 1, 1, 1));
|
||||
|
||||
// Raw furnace
|
||||
_rawFurnace.registerLoot(new RandomItem(Material.RAW_BEEF, 1, 1, 3));
|
||||
_rawFurnace.registerLoot(new RandomItem(Material.RAW_CHICKEN, 1, 1, 3));
|
||||
_rawFurnace.registerLoot(new RandomItem(Material.RAW_FISH, 1, 1, 3));
|
||||
_rawFurnace.registerLoot(new RandomItem(Material.PORK, 1, 1, 3));
|
||||
_rawFurnace.registerLoot(new RandomItem(Material.POTATO_ITEM, 1, 1, 3));
|
||||
_rawFurnace.addLoot(new RandomItem(Material.RAW_BEEF, 1, 1, 3));
|
||||
_rawFurnace.addLoot(new RandomItem(Material.RAW_CHICKEN, 1, 1, 3));
|
||||
_rawFurnace.addLoot(new RandomItem(Material.RAW_FISH, 1, 1, 3));
|
||||
_rawFurnace.addLoot(new RandomItem(Material.PORK, 1, 1, 3));
|
||||
_rawFurnace.addLoot(new RandomItem(Material.POTATO_ITEM, 1, 1, 3));
|
||||
|
||||
// Deathmatch Loot
|
||||
_deathMatchLoot.registerLoot(new RandomItem(Material.PUMPKIN_PIE, 4));
|
||||
_deathMatchLoot.registerLoot(new RandomItem(Material.BAKED_POTATO, 4));
|
||||
_deathMatchLoot.registerLoot(new RandomItem(Material.CAKE, 4));
|
||||
_deathMatchLoot.registerLoot(new RandomItem(Material.APPLE, 4));
|
||||
_deathMatchLoot.registerLoot(new RandomItem(Material.CARROT_ITEM, 4));
|
||||
_deathMatchLoot.registerLoot(new RandomItem(Material.WOOD_SWORD, 3));
|
||||
_deathMatchLoot.registerLoot(new RandomItem(Material.WOOD_AXE, 3));
|
||||
_deathMatchLoot.registerLoot(new RandomItem(Material.STONE_AXE, 3));
|
||||
_deathMatchLoot.registerLoot(new RandomItem(Material.STONE_SWORD, 1));
|
||||
_deathMatchLoot.addLoot(new RandomItem(Material.PUMPKIN_PIE, 4));
|
||||
_deathMatchLoot.addLoot(new RandomItem(Material.BAKED_POTATO, 4));
|
||||
_deathMatchLoot.addLoot(new RandomItem(Material.CAKE, 4));
|
||||
_deathMatchLoot.addLoot(new RandomItem(Material.APPLE, 4));
|
||||
_deathMatchLoot.addLoot(new RandomItem(Material.CARROT_ITEM, 4));
|
||||
_deathMatchLoot.addLoot(new RandomItem(Material.WOOD_SWORD, 3));
|
||||
_deathMatchLoot.addLoot(new RandomItem(Material.WOOD_AXE, 3));
|
||||
_deathMatchLoot.addLoot(new RandomItem(Material.STONE_AXE, 3));
|
||||
_deathMatchLoot.addLoot(new RandomItem(Material.STONE_SWORD, 1));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -10,31 +10,46 @@ import org.bukkit.event.inventory.ClickType;
|
||||
public class SpellButton implements IButton
|
||||
{
|
||||
|
||||
private SpellType _spell;
|
||||
private SpellMenuPage _spellPage;
|
||||
private SpellType _spell;
|
||||
private SpellMenuPage _spellPage;
|
||||
|
||||
public SpellButton(SpellMenuPage spellPage, SpellType spell)
|
||||
{
|
||||
_spell = spell;
|
||||
_spellPage = spellPage;
|
||||
}
|
||||
public SpellButton(SpellMenuPage spellPage, SpellType spell)
|
||||
{
|
||||
_spell = spell;
|
||||
_spellPage = spellPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
Wizard wizard = _spellPage.getWizards().getWizard(player);
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
Wizard wizard = _spellPage.getWizards().getWizard(player);
|
||||
|
||||
if (wizard != null)
|
||||
{
|
||||
wizard.setSpell(player.getInventory().getHeldItemSlot(), _spell);
|
||||
if (player.getInventory().getHeldItemSlot() >= wizard.getWandsOwned())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
player.sendMessage(C.cBlue + "Set spell on wand to " + _spell.getElement().getColor() + _spell.getSpellName());
|
||||
if (wizard != null)
|
||||
{
|
||||
if (clickType.isLeftClick())
|
||||
{
|
||||
wizard.setSpell(player.getInventory().getHeldItemSlot(), _spell);
|
||||
|
||||
player.playSound(player.getLocation(), Sound.ORB_PICKUP, 10, 1);
|
||||
player.sendMessage(C.cBlue + "Spell on wand set to " + _spell.getElement().getColor() + _spell.getSpellName());
|
||||
|
||||
_spellPage.getWizards().drawUtilTextBottom(player);
|
||||
_spellPage.getWizards().changeWandsTitles(player);
|
||||
}
|
||||
}
|
||||
player.playSound(player.getLocation(), Sound.ORB_PICKUP, 10, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
_spellPage.getWizards().castSpell(player, wizard, _spell, null);
|
||||
}
|
||||
|
||||
_spellPage.getWizards().drawUtilTextBottom(player);
|
||||
_spellPage.getWizards().changeWandsTitles(player);
|
||||
_spellPage.getWizards().changeWandsType(player, -1, player.getInventory().getHeldItemSlot());
|
||||
|
||||
player.closeInventory();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
package nautilus.game.arcade.game.games.wizards;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
@ -15,94 +14,113 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class SpellMenuPage extends ShopPageBase<WizardSpellMenu, WizardSpellMenuShop>
|
||||
{
|
||||
private Wizards _wizard;
|
||||
private Wizards _wizard;
|
||||
|
||||
public SpellMenuPage(WizardSpellMenu plugin, WizardSpellMenuShop shop, CoreClientManager clientManager,
|
||||
DonationManager donationManager, Player player, Wizards wizard)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, "Spell Menu", player);
|
||||
_wizard = wizard;
|
||||
buildPage();
|
||||
}
|
||||
public SpellMenuPage(WizardSpellMenu plugin, WizardSpellMenuShop shop, CoreClientManager clientManager,
|
||||
DonationManager donationManager, Player player, Wizards wizard)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, "Spell Menu", player);
|
||||
_wizard = wizard;
|
||||
buildPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void buildPage()
|
||||
{
|
||||
Wizard wizard = getWizards().getWizard(getPlayer());
|
||||
@Override
|
||||
protected void buildPage()
|
||||
{
|
||||
Wizard wizard = getWizards().getWizard(getPlayer());
|
||||
|
||||
ArrayList<Integer> usedNumbers = new ArrayList<Integer>();
|
||||
ArrayList<Integer> usedNumbers = new ArrayList<Integer>();
|
||||
|
||||
for (SpellElement ele : SpellElement.values())
|
||||
{
|
||||
addItem(ele.getSlot(), new ShopItem(ele.getIcon(), ele.name(), ele.name(), 1, true, true));
|
||||
for (SpellElement ele : SpellElement.values())
|
||||
{
|
||||
addItem(ele.getSlot(), new ShopItem(ele.getIcon(), ele.name(), ele.name(), 1, true, true));
|
||||
|
||||
for (int i = ele.getFirstSlot(); i <= ele.getSecondSlot(); i++)
|
||||
{
|
||||
usedNumbers.add(i);
|
||||
}
|
||||
}
|
||||
for (int i = ele.getFirstSlot(); i <= ele.getSecondSlot(); i++)
|
||||
{
|
||||
usedNumbers.add(i);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 54; i++)
|
||||
{
|
||||
SpellType spell = null;
|
||||
for (SpellType spells : SpellType.values())
|
||||
{
|
||||
if (spells.getSlot() == i)
|
||||
{
|
||||
spell = spells;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 54; i++)
|
||||
{
|
||||
SpellType spell = null;
|
||||
|
||||
if (usedNumbers.contains(i % 9) && spell != null)
|
||||
{
|
||||
for (SpellType spells : SpellType.values())
|
||||
{
|
||||
if (spells.getSlot() == i)
|
||||
{
|
||||
spell = spells;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int spellLevel = wizard == null ? 1 : wizard.getSpellLevel(spell);
|
||||
if (usedNumbers.contains(i % 9) && spell != null)
|
||||
{
|
||||
|
||||
if (spellLevel > 0)
|
||||
{
|
||||
ItemBuilder builder = new ItemBuilder(spell.getSpellItem());
|
||||
builder.setTitle(spell.getElement().getColor() + spell.getSpellName());
|
||||
builder.addLore("");
|
||||
builder.addLore(C.cBlue + C.Bold + "Spell Level: " + C.cWhite + spellLevel);
|
||||
builder.addLore(C.cBlue + C.Bold + "Mana Cost: " + C.cWhite
|
||||
+ (wizard == null ? spell.getBaseManaCost() : spell.getManaCost(wizard)));
|
||||
builder.addLore(C.cBlue + C.Bold + "Cooldown: " + C.cWhite
|
||||
+ (wizard == null ? spell.getBaseCooldown() : spell.getSpellCooldown(wizard)) + " seconds");
|
||||
builder.addLore("");
|
||||
int spellLevel = wizard == null ? 1 : wizard.getSpellLevel(spell);
|
||||
|
||||
for (String lore : spell.getDesc())
|
||||
{
|
||||
builder.addLore(C.cGray + lore, 35);
|
||||
}
|
||||
if (spellLevel > 0)
|
||||
{
|
||||
ItemBuilder builder = new ItemBuilder(spell.getSpellItem());
|
||||
|
||||
if (wizard == null)
|
||||
{
|
||||
addItem(i, new ShopItem(builder.build(), spell.name(), spell.name(), 1, true, true));
|
||||
}
|
||||
else
|
||||
{
|
||||
addButton(i, new ShopItem(builder.build(), spell.name(), spell.name(), 1, true, true), new SpellButton(
|
||||
this, spell));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
addItem(i, new ShopItem(new ItemBuilder(Material.INK_SACK, 1, (byte) 8).setTitle(C.cRed + C.Bold + "Unknown")
|
||||
.build(), "Unknown", "Unknown", 1, true, true));
|
||||
}
|
||||
}
|
||||
else if (!usedNumbers.contains(i % 9))
|
||||
{
|
||||
addItem(i, new ShopItem(new ItemBuilder(Material.STAINED_GLASS_PANE, 1, (byte) 15).setTitle(C.cRed + "").build(),
|
||||
"No Item", "No Item", 1, true, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
builder.setTitle(spell.getElement().getColor() + C.Bold + spell.getSpellName());
|
||||
|
||||
public Wizards getWizards()
|
||||
{
|
||||
return _wizard;
|
||||
}
|
||||
builder.setAmount(spellLevel);
|
||||
|
||||
builder.addLore("");
|
||||
|
||||
if (wizard == null)
|
||||
{
|
||||
builder.addLore(C.cYellow + C.Bold + "Max Level: " + C.cWhite + spell.getMaxLevel());
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.addLore(C.cYellow + C.Bold + "Spell Level: " + C.cWhite + spellLevel);
|
||||
}
|
||||
|
||||
builder.addLore(C.cYellow + C.Bold + "Mana Cost: " + C.cWhite
|
||||
+ (wizard == null ? spell.getBaseManaCost() : spell.getManaCost(wizard)));
|
||||
builder.addLore(C.cYellow + C.Bold + "Cooldown: " + C.cWhite
|
||||
+ (wizard == null ? spell.getBaseCooldown() : spell.getSpellCooldown(wizard)) + " seconds");
|
||||
builder.addLore("");
|
||||
|
||||
for (String lore : spell.getDesc())
|
||||
{
|
||||
builder.addLore(C.cGray + lore, 40);
|
||||
}
|
||||
|
||||
if (wizard == null)
|
||||
{
|
||||
addItem(i, new ShopItem(builder.build(), spell.name(), spell.name(), 1, true, true));
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.addLore("");
|
||||
|
||||
builder.addLore(C.cGreen + C.Bold + "Left-Click" + C.cWhite + " Bind to Wand");
|
||||
|
||||
builder.addLore(C.cGreen + C.Bold + "Right-Click" + C.cWhite + " Quickcast Spell");
|
||||
|
||||
addButton(i, new ShopItem(builder.build(), spell.name(), spell.name(), 1, true, true), new SpellButton(
|
||||
this, spell));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
addItem(i, new ShopItem(new ItemBuilder(Material.INK_SACK, 1, (byte) 6).setTitle(C.cRed + C.Bold + "Unknown")
|
||||
.build(), "Unknown", "Unknown", 1, true, true));
|
||||
}
|
||||
}
|
||||
else if (!usedNumbers.contains(i % 9))
|
||||
{
|
||||
addItem(i, new ShopItem(new ItemBuilder(Material.INK_SACK, 1, (byte) 9).setTitle(C.cRed + "").build(), "No Item",
|
||||
"No Item", 1, true, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Wizards getWizards()
|
||||
{
|
||||
return _wizard;
|
||||
}
|
||||
}
|
||||
|
@ -1,60 +1,25 @@
|
||||
package nautilus.game.arcade.game.games.wizards;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import nautilus.game.arcade.game.games.wizards.spells.SpellBridge;
|
||||
import nautilus.game.arcade.game.games.wizards.spells.SpellDroom;
|
||||
import nautilus.game.arcade.game.games.wizards.spells.SpellExplosiveRune;
|
||||
import nautilus.game.arcade.game.games.wizards.spells.SpellFireball;
|
||||
import nautilus.game.arcade.game.games.wizards.spells.SpellFlash;
|
||||
import nautilus.game.arcade.game.games.wizards.spells.SpellHeal;
|
||||
import nautilus.game.arcade.game.games.wizards.spells.SpellHealingRune;
|
||||
import nautilus.game.arcade.game.games.wizards.spells.SpellImplode;
|
||||
import nautilus.game.arcade.game.games.wizards.spells.SpellLance;
|
||||
import nautilus.game.arcade.game.games.wizards.spells.SpellLaunch;
|
||||
import nautilus.game.arcade.game.games.wizards.spells.SpellLaunchRune;
|
||||
import nautilus.game.arcade.game.games.wizards.spells.SpellLightningStrike;
|
||||
import nautilus.game.arcade.game.games.wizards.spells.SpellMagicMissile;
|
||||
import nautilus.game.arcade.game.games.wizards.spells.SpellRainbowBeam;
|
||||
import nautilus.game.arcade.game.games.wizards.spells.SpellRumble;
|
||||
import nautilus.game.arcade.game.games.wizards.spells.SpellSpeedBoost;
|
||||
import nautilus.game.arcade.game.games.wizards.spells.SpellSpiderman;
|
||||
import nautilus.game.arcade.game.games.wizards.spells.SpellStoneWall;
|
||||
import nautilus.game.arcade.game.games.wizards.spells.SpellSummonWolves;
|
||||
import nautilus.game.arcade.game.games.wizards.spells.SpellTeleportRune;
|
||||
import nautilus.game.arcade.game.games.wizards.spells.SpellTrapRune;
|
||||
import nautilus.game.arcade.game.games.wizards.spells.SpellWizardsCompass;
|
||||
import nautilus.game.arcade.game.games.wizards.spells.*;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public enum SpellType // ❤
|
||||
{
|
||||
|
||||
Bridge(SpellElement.MISC, // Spell element
|
||||
"Bridge", // Spell name
|
||||
new ItemStack(Material.FENCE), // Spell icon
|
||||
SpellBridge.class, // Spell class
|
||||
3, // Spell max level
|
||||
50, // Mana cost
|
||||
20, // Spell cooldown
|
||||
0, // Mana cost change per level
|
||||
-5, // Cooldown change per level
|
||||
3, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Length: " + C.Bold + C.cWhite + "Spell Level x 10",
|
||||
|
||||
"",
|
||||
|
||||
"Left click on the block before the chasm",
|
||||
|
||||
"and a mighty dirt bridge will appear!"),
|
||||
|
||||
Droom(SpellElement.ATTACK, // Spell element
|
||||
"Droom", // Spell name
|
||||
new ItemStack(Material.ANVIL), // Spell icon
|
||||
SpellDroom.class, // Spell class
|
||||
AnvilDrop(SpellElement.ATTACK, // Spell element
|
||||
WandElement.EARTH, // Wand element
|
||||
"Anvil Drop", // Spell name
|
||||
new ItemStack(Material.NETHER_BRICK_ITEM), // Spell icon
|
||||
SpellAnvilDrop.class, // Spell class
|
||||
3, // Spell max level
|
||||
40, // Mana cost
|
||||
15, // Spell cooldown
|
||||
@ -62,53 +27,18 @@ public enum SpellType // ❤
|
||||
-4, // Cooldown change per level
|
||||
10, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Explosion Size: " + C.Bold + C.cWhite + "(Spell Level / 2) + 1",
|
||||
C.cYellow + C.Bold + "Damage: " + C.Bold + C.cWhite + "(Spell Level x 2) + 3",
|
||||
|
||||
"",
|
||||
|
||||
"Summons exploding anvils over everyone near you!"),
|
||||
"Summons exploding anvils over everyone near you!",
|
||||
|
||||
/*Drain(SpellElement.MISC, // Spell element
|
||||
"Drain", // Spell name
|
||||
new ItemStack(Material.BUCKET), // Spell icon
|
||||
SpellDrain.class, // Spell class
|
||||
3, // Spell max level
|
||||
30, // Mana cost
|
||||
20, // Spell cooldown
|
||||
-3, // Mana cost change per level
|
||||
-4, // Cooldown change per level
|
||||
3, // Item amount in loot
|
||||
|
||||
"",
|
||||
|
||||
"Right click other players with this spell",
|
||||
|
||||
"to empty their mana reserves!", TODO Make this area based and drain completely of mana or a rune and drain passively.
|
||||
|
||||
"You gain a third of the absorbed mana!"),*/
|
||||
|
||||
ExplosiveRune(SpellElement.RUNES, // Spell element
|
||||
"Explosive Rune", // Spell name
|
||||
new ItemStack(Material.FIREBALL), // Spell icon
|
||||
SpellExplosiveRune.class, // Spell class
|
||||
3, // Spell max level
|
||||
60, // Mana cost
|
||||
30, // Spell cooldown
|
||||
0, // Mana cost change per level
|
||||
0, // Cooldown change per level
|
||||
5, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Explosion Size: " + C.Bold + C.cWhite + "Spell Level",
|
||||
|
||||
C.cGold + C.Bold + "Rune Size: " + C.Bold + C.cWhite + "Spell Level + 1",
|
||||
|
||||
"",
|
||||
|
||||
"Draws a rune that explodes after a delay!"),
|
||||
"This also includes the caster!"),
|
||||
|
||||
Fireball(SpellElement.ATTACK, // Spell element
|
||||
WandElement.FIRE, // Wand element
|
||||
"Fireball", // Spell name
|
||||
new ItemStack(Material.FIREBALL), // Spell icon
|
||||
new ItemStack(Material.COAL), // Spell icon
|
||||
SpellFireball.class, // Spell class
|
||||
3, // Spell max level
|
||||
30, // Mana cost
|
||||
@ -117,7 +47,7 @@ public enum SpellType // ❤
|
||||
-2, // Cooldown change per level
|
||||
10, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Explosion Size: " + C.Bold + C.cWhite + "(Spell Level x 0.25) + 0.8",
|
||||
C.cYellow + C.Bold + "Damage: " + C.Bold + C.cWhite + "Spell Level + 3",
|
||||
|
||||
"",
|
||||
|
||||
@ -126,25 +56,67 @@ public enum SpellType // ❤
|
||||
"Summon a blazing fireball!"),
|
||||
|
||||
Flash(SpellElement.SUPPORT, // Spell element
|
||||
WandElement.LIFE, // Wand element
|
||||
"Flash", // Spell name
|
||||
new ItemStack(Material.REDSTONE_TORCH_ON), // Spell icon
|
||||
new ItemStack(Material.GOLD_NUGGET), // Spell icon
|
||||
SpellFlash.class, // Spell class
|
||||
3, // Spell max level
|
||||
50, // Mana cost
|
||||
20, // Mana cost
|
||||
50, // Spell cooldown
|
||||
0, // Mana cost change per level
|
||||
-5, // Cooldown change per level
|
||||
3, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Range: " + C.Bold + C.cWhite + "(Spell Level x 10) + 20",
|
||||
C.cYellow + C.Bold + "Range: " + C.Bold + C.cWhite + "(Spell Level x 10) + 20",
|
||||
|
||||
"",
|
||||
|
||||
"Teleport to the block you are looking at!"),
|
||||
|
||||
FrostBarrier(SpellElement.MISC, // Spell element
|
||||
WandElement.ICE, // Wand element
|
||||
"Frost Barrier", // Spell name
|
||||
new ItemStack(Material.CLAY_BALL), // Spell icon
|
||||
SpellFrostBarrier.class, // Spell class
|
||||
3, // Spell max level
|
||||
10, // Mana cost
|
||||
20, // Spell cooldown
|
||||
0, // Mana cost change per level
|
||||
-5, // Cooldown change per level
|
||||
3, // Item amount in loot
|
||||
|
||||
C.cYellow + C.Bold + "Height: " + C.Bold + C.cWhite + "Spell Level + 1",
|
||||
|
||||
C.cYellow + C.Bold + "Width: " + C.Bold + C.cWhite + "(Spell Level x 2) + 4",
|
||||
|
||||
"",
|
||||
|
||||
"Create a wall of ice!"),
|
||||
|
||||
Gust(SpellElement.MISC, // Spell element
|
||||
WandElement.AIR, // Wand element
|
||||
"Gust", // Spell name
|
||||
new ItemStack(Material.SULPHUR), // Spell icon
|
||||
SpellGust.class, // Spell class
|
||||
3, // Spell max level
|
||||
15, // Mana cost
|
||||
20, // Spell cooldown
|
||||
0, // Mana cost change per level
|
||||
0, // Cooldown change per level
|
||||
5, // Item amount in loot
|
||||
|
||||
C.cYellow + C.Bold + "Gust Size: " + C.Bold + C.cWhite + "10 x Spell Level blocks",
|
||||
|
||||
C.cYellow + C.Bold + "Gust Strength: " + C.Bold + C.cWhite + "Spell Level x 30%",
|
||||
|
||||
"",
|
||||
|
||||
"Cast the spell and watch your enemies fly!"),
|
||||
|
||||
Heal(SpellElement.SUPPORT, // Spell element
|
||||
WandElement.LIFE, // Wand element
|
||||
"Heal", // Spell name
|
||||
new ItemStack(Material.POTION, 1, (short) 8261), // Spell icon
|
||||
new ItemStack(Material.QUARTZ), // Spell icon
|
||||
SpellHeal.class, // Spell class
|
||||
5, // Spell max level
|
||||
50, // Mana cost
|
||||
@ -153,7 +125,7 @@ public enum SpellType // ❤
|
||||
-1, // Cooldown change per level
|
||||
5, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Heals: " + C.Bold + C.cWhite + "(Spell Level / 2) + 1.5",
|
||||
C.cYellow + C.Bold + "Heals: " + C.Bold + C.cWhite + "(Spell Level / 2) + 1.5",
|
||||
|
||||
"",
|
||||
|
||||
@ -161,30 +133,56 @@ public enum SpellType // ❤
|
||||
|
||||
"Use this! Heal yourself up!"),
|
||||
|
||||
HealingRune(SpellElement.RUNES, // Spell element
|
||||
"Rune of Healing", // Spell name
|
||||
new ItemStack(Material.POTION, 1, (short) 8197), // Spell icon
|
||||
SpellHealingRune.class, // Spell class
|
||||
IcePrison(SpellElement.MISC, // Spell element
|
||||
WandElement.ICE, // Wand element
|
||||
"Ice Prison", // Spell name
|
||||
new ItemStack(Material.EYE_OF_ENDER), // Spell icon
|
||||
SpellIcePrison.class, // Spell class
|
||||
3, // Spell max level
|
||||
60, // Mana cost
|
||||
30, // Spell cooldown
|
||||
0, // Mana cost change per level
|
||||
-5, // Cooldown change per level
|
||||
25, // Mana cost
|
||||
20, // Spell cooldown
|
||||
2, // Mana cost change per level
|
||||
0, // Cooldown change per level
|
||||
3, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Size: " + C.Bold + C.cWhite + "(Spell Level x 0.5) + 2",
|
||||
|
||||
C.cGold + C.Bold + "Lasts for: " + C.Bold + C.cWhite + "(Spell Level x 3) + 5 seconds",
|
||||
C.cYellow + C.Bold + "Size: " + C.Bold + C.cWhite + "Spell Level + 3",
|
||||
|
||||
"",
|
||||
|
||||
"Draws a rune of healing players can step inside",
|
||||
"On impact creates a mighty ice",
|
||||
|
||||
"to recover their health."),
|
||||
"prison to capture thy enemies!"),
|
||||
|
||||
IceShards(SpellElement.ATTACK, // Spell element
|
||||
WandElement.ICE, // Wand element
|
||||
"Ice Shards", // Spell name
|
||||
new ItemStack(Material.GOLDEN_CARROT), // Spell icon
|
||||
SpellIceShards.class, // Spell class
|
||||
5, // Spell max level
|
||||
30, // Mana cost
|
||||
20, // Spell cooldown
|
||||
0, // Mana cost change per level
|
||||
-2, // Cooldown change per level
|
||||
3, // Item amount in loot
|
||||
|
||||
C.cYellow + C.Bold + "Damage: " + C.Bold + C.cWhite + "2",
|
||||
|
||||
C.cYellow + C.Bold + "Shards: " + C.Bold + C.cWhite + "Spell Level + 1",
|
||||
|
||||
"",
|
||||
|
||||
"Overwhelm your opponent with shards!",
|
||||
|
||||
"Each shard is fired half a second after",
|
||||
|
||||
"the last allowing you to pummel your",
|
||||
|
||||
"enemies senseless!"),
|
||||
|
||||
Implode(SpellElement.MISC, // Spell element
|
||||
WandElement.EARTH, // Wand element
|
||||
"Implode", // Spell name
|
||||
new ItemStack(Material.TNT), // Spell icon
|
||||
new ItemStack(Material.GLOWSTONE_DUST), // Spell icon
|
||||
SpellImplode.class, // Spell class
|
||||
3, // Spell max level
|
||||
50, // Mana cost
|
||||
@ -193,11 +191,11 @@ public enum SpellType // ❤
|
||||
-3, // Cooldown change per level
|
||||
3, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Range: " + C.Bold + C.cWhite + "50",
|
||||
C.cYellow + C.Bold + "Range: " + C.Bold + C.cWhite + "50",
|
||||
|
||||
C.cGold + C.Bold + "Implosion Height: " + C.Bold + C.cWhite + "Spell Level",
|
||||
C.cYellow + C.Bold + "Implosion Height: " + C.Bold + C.cWhite + "Spell Level",
|
||||
|
||||
C.cGold + C.Bold + "Implosion Width: " + C.Bold + C.cWhite + "Spell Level x 2",
|
||||
C.cYellow + C.Bold + "Implosion Width: " + C.Bold + C.cWhite + "Spell Level x 2",
|
||||
|
||||
"",
|
||||
|
||||
@ -205,70 +203,10 @@ public enum SpellType // ❤
|
||||
|
||||
"and scatters them about the area"),
|
||||
|
||||
Lance(SpellElement.ATTACK, // Spell element
|
||||
"Lance", // Spell name
|
||||
new ItemStack(Material.STICK), // Spell icon
|
||||
SpellLance.class, // Spell class
|
||||
3, // Spell max level
|
||||
75, // Mana cost
|
||||
50, // Spell cooldown
|
||||
0, // Mana cost change per level
|
||||
-10, // Cooldown change per level
|
||||
10, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Lance Size: " + C.Bold + C.cWhite + "Spell Level x 6",
|
||||
|
||||
"",
|
||||
|
||||
"Summon an lance of explosions!"),
|
||||
|
||||
Launch(SpellElement.MISC, // Spell element
|
||||
"Launch", // Spell name
|
||||
new ItemStack(Material.FEATHER), // Spell icon
|
||||
SpellLaunch.class, // Spell class
|
||||
3, // Spell max level
|
||||
60, // Mana cost
|
||||
20, // Spell cooldown
|
||||
0, // Mana cost change per level
|
||||
0, // Cooldown change per level
|
||||
5, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Launch Height: " + C.Bold + C.cWhite + "(Spell Level x 3) + 5 blocks",
|
||||
|
||||
"",
|
||||
|
||||
"Cast the spell by hitting the victim",
|
||||
|
||||
"and they will be sent flying into the air!"),
|
||||
|
||||
LaunchRune(SpellElement.RUNES, // Spell element
|
||||
"Launch Rune", // Spell name
|
||||
new ItemStack(Material.FEATHER), // Spell icon
|
||||
SpellLaunchRune.class, // Spell class
|
||||
3, // Spell max level
|
||||
60, // Mana cost
|
||||
30, // Spell cooldown
|
||||
0, // Mana cost change per level
|
||||
0, // Cooldown change per level
|
||||
5, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Launch Height: " + C.Bold + C.cWhite + "(Spell Level x 2) + 5 blocks",
|
||||
|
||||
C.cGold + C.Bold + "Rune Size: " + C.Bold + C.cWhite + "Spell Level x 0.8",
|
||||
|
||||
"",
|
||||
|
||||
"Draws a white rune on the ground",
|
||||
|
||||
"Rune lasts for a minute and will",
|
||||
|
||||
"activate when stepped on to launch",
|
||||
|
||||
"the people into the air"),
|
||||
|
||||
LightningStrike(SpellElement.ATTACK, // Spell element
|
||||
WandElement.AIR, // Wand element
|
||||
"Lightning Strike", // Spell name
|
||||
new ItemStack(Material.WOOD_AXE), // Spell icon
|
||||
new ItemStack(Material.INK_SACK, 1, (short) 12), // Spell icon
|
||||
SpellLightningStrike.class, // Spell class
|
||||
3, // Spell max level
|
||||
50, // Mana cost
|
||||
@ -277,16 +215,21 @@ public enum SpellType // ❤
|
||||
0, // Cooldown change per level
|
||||
10, // Item amount in loot
|
||||
|
||||
C.cYellow + C.Bold + "Damage: " + C.Bold + C.cWhite + "(Spell Level x 2) + 2",
|
||||
|
||||
"",
|
||||
|
||||
"Summon a mighty lightning strike",
|
||||
|
||||
"to hit the target you point out!"),
|
||||
|
||||
MagicMissile(SpellElement.ATTACK, // Spell element
|
||||
"Magic Missile", // Spell name
|
||||
new ItemStack(Material.STICK), // Spell icon
|
||||
SpellMagicMissile.class, // Spell class
|
||||
"to hit the target you point out!",
|
||||
|
||||
"The lightning also contains fire!"),
|
||||
|
||||
ManaBolt(SpellElement.ATTACK, // Spell element
|
||||
WandElement.AIR, // Wand element
|
||||
"Mana Bolt", // Spell name
|
||||
new ItemStack(Material.MELON_SEEDS), // Spell icon
|
||||
SpellManaBolt.class, // Spell class
|
||||
3, // Spell max level
|
||||
15, // Mana cost
|
||||
5, // Spell cooldown
|
||||
@ -294,19 +237,41 @@ public enum SpellType // ❤
|
||||
0, // Cooldown change per level
|
||||
15, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Damage: " + C.Bold + C.cWhite + "(Spell Level / 2) + 2",
|
||||
C.cYellow + C.Bold + "Damage: " + C.Bold + C.cWhite + "Spell Level + 2",
|
||||
|
||||
C.cGold + C.Bold + "Range: " + C.Bold + C.cWhite + "Spell Level x 15",
|
||||
C.cYellow + C.Bold + "Range: " + C.Bold + C.cWhite + "(Spell Level x 10) + 20",
|
||||
|
||||
"",
|
||||
|
||||
"The basic spell all beginner mages are taught.",
|
||||
"Basic spell all beginner mages are taught," + " this creates a mana missile commonly attributed towards "
|
||||
+ "the magic profession and homes in towards the closest target!"),
|
||||
|
||||
"This creates a magic missile that is commonly attributed to the magic profession."),
|
||||
Napalm(SpellElement.ATTACK, // Spell element
|
||||
WandElement.FIRE, // Wand element
|
||||
"Napalm", // Spell name
|
||||
new ItemStack(Material.CARROT_STICK), // Spell icon
|
||||
SpellNapalm.class, // Spell class
|
||||
5, // Spell max level
|
||||
60, // Mana cost
|
||||
60, // Spell cooldown
|
||||
5, // Mana cost change per level
|
||||
-10, // Cooldown change per level
|
||||
1, // Item amount in loot
|
||||
|
||||
C.cYellow + C.Bold + "Length: " + C.Bold + C.cWhite + "(Spell Level x 10) + 5",
|
||||
|
||||
"",
|
||||
|
||||
"Creates a ball of fire that grows",
|
||||
|
||||
"the longer it lives. At an large size",
|
||||
|
||||
"it even burns away nearby blocks!"),
|
||||
|
||||
RainbowBeam(SpellElement.ATTACK, // Spell element
|
||||
WandElement.FIRE, // Wand element
|
||||
"Rainbow Beam", // Spell name
|
||||
new ItemStack(Material.EMERALD), // Spell icon
|
||||
new ItemStack(Material.INK_SACK, 1, (short) 10), // Spell icon
|
||||
SpellRainbowBeam.class, // Spell class
|
||||
5, // Spell max level
|
||||
5, // Mana cost
|
||||
@ -315,99 +280,117 @@ public enum SpellType // ❤
|
||||
1, // Cooldown change per level
|
||||
10, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Damage: " + C.Bold + C.cWhite + "Spell Level + 3",
|
||||
C.cYellow + C.Bold + "Damage: " + C.Bold + C.cWhite + "Spell Level + 2",
|
||||
|
||||
C.cGold + C.Bold + "Ramge: " + C.Bold + C.cWhite + "Spell Level x 20",
|
||||
C.cYellow + C.Bold + "Range: " + C.Bold + C.cWhite + "80",
|
||||
|
||||
"",
|
||||
|
||||
"Magical girl beam of rainbows!",
|
||||
"Firing rainbow beams of love and hope!",
|
||||
|
||||
"This may not do much damage,",
|
||||
"This spell damages the target instantly!",
|
||||
|
||||
"but it sure is pretty!"),
|
||||
"The thing is, to make this fit in with our",
|
||||
|
||||
Rumble(SpellElement.ATTACK, // Spell element
|
||||
"Rumble", // Spell name
|
||||
new ItemStack(Material.DIRT), // Spell icon
|
||||
SpellRumble.class, // Spell class
|
||||
5, // Spell max level
|
||||
30, // Mana cost
|
||||
5, // Spell cooldown
|
||||
0, // Mana cost change per level
|
||||
0, // Cooldown change per level
|
||||
10, // Item amount in loot
|
||||
"budget the damage will decrease after",
|
||||
|
||||
C.cGold + C.Bold + "Damage: " + C.Bold + C.cWhite + "Spell Level + 2",
|
||||
"30 blocks by 0.2 damage per block!"),
|
||||
|
||||
C.cGold + C.Bold + "Range: " + C.Bold + C.cWhite + "Spell Level x 10",
|
||||
|
||||
"",
|
||||
|
||||
"Creates an targeted earthquake",
|
||||
|
||||
"in the direction you point",
|
||||
|
||||
"from the block you left click!"),
|
||||
|
||||
SpeedBoost(SpellElement.SUPPORT, // Spell element
|
||||
"Speed Boost", // Spell name
|
||||
new ItemStack(Material.FEATHER), // Spell icon
|
||||
SpellSpeedBoost.class, // Spell class
|
||||
2, // Spell max level
|
||||
20, // Mana cost
|
||||
100, // Spell cooldown
|
||||
RainbowRoad(SpellElement.MISC, // Spell element
|
||||
WandElement.AIR, // Wand element
|
||||
"Rainbow Road", // Spell name
|
||||
new ItemStack(Material.SADDLE), // Spell icon
|
||||
SpellRainbowRoad.class, // Spell class
|
||||
3, // Spell max level
|
||||
10, // Mana cost
|
||||
20, // Spell cooldown
|
||||
0, // Mana cost change per level
|
||||
0, // Cooldown change per level
|
||||
3, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Length: " + C.Bold + C.cWhite + "Spell Level x 30",
|
||||
C.cYellow + C.Bold + "Length: " + C.Bold + C.cWhite + "Spell Level x 10",
|
||||
|
||||
C.cGold + C.Bold + "Strength: " + C.Bold + C.cWhite + "Spell Level",
|
||||
"",
|
||||
|
||||
"Summon into being a mighty road",
|
||||
|
||||
"of rainbows for thee to walk on!"),
|
||||
|
||||
Rumble(SpellElement.ATTACK, // Spell element
|
||||
WandElement.EARTH, // Wand element
|
||||
"Rumble", // Spell name
|
||||
new ItemStack(Material.PUMPKIN_SEEDS), // Spell icon
|
||||
SpellRumble.class, // Spell class
|
||||
5, // Spell max level
|
||||
30, // Mana cost
|
||||
15, // Spell cooldown
|
||||
0, // Mana cost change per level
|
||||
-1, // Cooldown change per level
|
||||
10, // Item amount in loot
|
||||
|
||||
C.cYellow + C.Bold + "Damage: " + C.Bold + C.cWhite + "Spell Level + 2",
|
||||
|
||||
C.cYellow + C.Bold + "Explosion Damage: " + C.Bold + C.cWhite + "Spell Level / 4",
|
||||
|
||||
C.cYellow + C.Bold + "Range: " + C.Bold + C.cWhite + "Spell Level x 10",
|
||||
|
||||
C.cYellow + C.Bold + "Slowness Level: " + C.Bold + C.cWhite + "Spell Level",
|
||||
|
||||
"",
|
||||
|
||||
"Creates a targeted earthquake",
|
||||
|
||||
"in the direction you face!",
|
||||
|
||||
"Explodes with damage at the end!",
|
||||
|
||||
"Effected players lose their footing!"),
|
||||
|
||||
SpectralArrow(SpellElement.ATTACK, // Spell element
|
||||
WandElement.DEATH, // Wand element
|
||||
"Spectral Arrow", // Spell name
|
||||
new ItemBuilder(Material.INK_SACK, 1, (short) 13).addEnchantment(UtilInv.getDullEnchantment(), 1).build(), // Spell
|
||||
// icon
|
||||
SpellSpectralArrow.class, // Spell class
|
||||
3, // Spell max level
|
||||
40, // Mana cost
|
||||
15, // Spell cooldown
|
||||
-5, // Mana cost change per level
|
||||
-2, // Cooldown change per level
|
||||
3, // Item amount in loot
|
||||
|
||||
C.cYellow + C.Bold + "Damage: " + C.Bold + C.cWhite + "(Blocks / (7 - Spell Level)) + 3",
|
||||
|
||||
"",
|
||||
|
||||
"Shoot an arrow that penetrates!",
|
||||
|
||||
"Further the distance, higher the damage!"),
|
||||
|
||||
SpeedBoost(SpellElement.SUPPORT, // Spell element
|
||||
WandElement.LIFE, // Wand element
|
||||
"Speed Boost", // Spell name
|
||||
new ItemStack(Material.INK_SACK, 1, (short) 2), // Spell icon
|
||||
SpellSpeedBoost.class, // Spell class
|
||||
2, // Spell max level
|
||||
20, // Mana cost
|
||||
40, // Spell cooldown
|
||||
0, // Mana cost change per level
|
||||
0, // Cooldown change per level
|
||||
3, // Item amount in loot
|
||||
|
||||
C.cYellow + C.Bold + "Length: " + C.Bold + C.cWhite + "20 seconds",
|
||||
|
||||
C.cYellow + C.Bold + "Strength: " + C.Bold + C.cWhite + "Spell Level + 1",
|
||||
|
||||
"",
|
||||
|
||||
"Gain a speed potion effect to outrun your enemies"),
|
||||
|
||||
Spiderman(SpellElement.MISC, // Spell element
|
||||
"Spiderman", // Spell name
|
||||
new ItemStack(Material.WEB), // Spell icon
|
||||
SpellSpiderman.class, // Spell class
|
||||
3, // Spell max level
|
||||
40, // Mana cost
|
||||
20, // Spell cooldown
|
||||
-5, // Mana cost change per level
|
||||
-5, // Cooldown change per level
|
||||
3, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Webs: " + C.Bold + C.cWhite + "Spell Level x 2",
|
||||
|
||||
"",
|
||||
|
||||
"Shoot webs just like your favorite hero!"),
|
||||
|
||||
StoneWall(SpellElement.MISC, // Spell element
|
||||
"Stone Wall", // Spell name
|
||||
new ItemStack(Material.STONE), // Spell icon
|
||||
SpellStoneWall.class, // Spell class
|
||||
3, // Spell max level
|
||||
60, // Mana cost
|
||||
30, // Spell cooldown
|
||||
0, // Mana cost change per level
|
||||
-5, // Cooldown change per level
|
||||
3, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Height: " + C.Bold + C.cWhite + "Spell Level + 1",
|
||||
|
||||
C.cGold + C.Bold + "Width: " + C.Bold + C.cWhite + "Spell Level x 5",
|
||||
|
||||
"",
|
||||
|
||||
"Create a wall of stone!"),
|
||||
|
||||
SummonWolves(SpellElement.ATTACK, // Spell element
|
||||
SummonWolves(SpellElement.MISC, // Spell element
|
||||
WandElement.LIFE, // Wand element
|
||||
"Summon Wolves", // Spell name
|
||||
new ItemStack(Material.MONSTER_EGG, 1, EntityType.WOLF.getTypeId()), // Spell icon
|
||||
new ItemStack(Material.MILK_BUCKET), // Spell icon
|
||||
SpellSummonWolves.class, // Spell class
|
||||
3, // Spell max level
|
||||
80, // Mana cost
|
||||
@ -416,7 +399,7 @@ public enum SpellType // ❤
|
||||
0, // Cooldown change per level
|
||||
8, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Wolves: " + C.Bold + C.cWhite + "Spell Level + 2",
|
||||
C.cYellow + C.Bold + "Wolves: " + C.Bold + C.cWhite + "Spell Level + 2",
|
||||
|
||||
"",
|
||||
|
||||
@ -424,47 +407,23 @@ public enum SpellType // ❤
|
||||
|
||||
"They will fight for you and after 30 seconds, will disappear"),
|
||||
|
||||
TeleportRune(SpellElement.RUNES, // Spell element
|
||||
"Teleport Rune", // Spell name
|
||||
new ItemStack(Material.ENDER_PEARL), // Spell icon
|
||||
SpellTeleportRune.class, // Spell class
|
||||
3, // Spell max level
|
||||
70, // Mana cost
|
||||
40, // Spell cooldown
|
||||
-5, // Mana cost change per level
|
||||
-5, // Cooldown change per level
|
||||
4, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Range: " + C.Bold + C.cWhite + "Spell Level x 25",
|
||||
|
||||
C.cGold + C.Bold + "Size: " + C.Bold + C.cWhite + "Spell Level x 1.5",
|
||||
|
||||
"",
|
||||
|
||||
"This draws a teleport rune on the ground",
|
||||
|
||||
"The created rune is usable by anyone and lasts",
|
||||
|
||||
"for 5 seconds after the 2 second warmup period.",
|
||||
|
||||
"The teleport is one way, you cannot return."),
|
||||
|
||||
TrapRune(SpellElement.RUNES, // Spell element
|
||||
TrapRune(SpellElement.MISC, // Spell element
|
||||
WandElement.DEATH, // Wand element
|
||||
"Trap Rune", // Spell name
|
||||
new ItemStack(Material.TRAP_DOOR), // Spell icon
|
||||
new ItemStack(Material.SHEARS), // Spell icon
|
||||
SpellTrapRune.class, // Spell class
|
||||
3, // Spell max level
|
||||
50, // Mana cost
|
||||
25, // Mana cost
|
||||
30, // Spell cooldown
|
||||
0, // Mana cost change per level
|
||||
-5, // Cooldown change per level
|
||||
3, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Range: " + C.Bold + C.cWhite + "(Spell Level x 4) + 12",
|
||||
C.cYellow + C.Bold + "Damage: " + C.Bold + C.cWhite + "(Spell Level x 2) + 3",
|
||||
|
||||
C.cGold + C.Bold + "Rune Size: " + C.Bold + C.cWhite + "Spell Level",
|
||||
C.cYellow + C.Bold + "Range: " + C.Bold + C.cWhite + "(Spell Level x 4) + 12",
|
||||
|
||||
C.cGold + C.Bold + "Explosion Size: " + C.Bold + C.cWhite + "Spell Level",
|
||||
C.cYellow + C.Bold + "Rune Size: " + C.Bold + C.cWhite + "Spell Level",
|
||||
|
||||
"",
|
||||
|
||||
@ -472,9 +431,30 @@ public enum SpellType // ❤
|
||||
|
||||
"The rune takes 5 seconds to prepare and will damage even you!"),
|
||||
|
||||
WebShot(SpellElement.MISC, // Spell element
|
||||
WandElement.DEATH, // Wand element
|
||||
"Web Shot", // Spell name
|
||||
new ItemStack(Material.SPIDER_EYE), // Spell icon
|
||||
SpellWebShot.class, // Spell class
|
||||
3, // Spell max level
|
||||
40, // Mana cost
|
||||
20, // Spell cooldown
|
||||
-5, // Mana cost change per level
|
||||
0, // Cooldown change per level
|
||||
3, // Item amount in loot
|
||||
|
||||
C.cYellow + C.Bold + "Damage: " + C.Bold + C.cWhite + "1 heart",
|
||||
|
||||
C.cYellow + C.Bold + "Webs: " + C.Bold + C.cWhite + "Spell Level x 2",
|
||||
|
||||
"",
|
||||
|
||||
"Shoot webs just like your favorite hero!"),
|
||||
|
||||
WizardsCompass(SpellElement.MISC, // Spell element
|
||||
WandElement.LIFE, // Wand element
|
||||
"Wizard's Compass", // Spell name
|
||||
new ItemStack(Material.COMPASS), // Spell icon
|
||||
new ItemStack(Material.SUGAR), // Spell icon
|
||||
SpellWizardsCompass.class, // Spell class
|
||||
1, // Spell max level
|
||||
5, // Mana cost
|
||||
@ -489,19 +469,16 @@ public enum SpellType // ❤
|
||||
|
||||
public enum SpellElement
|
||||
{
|
||||
ATTACK(0, 0, 1, new ItemBuilder(Material.IRON_SWORD).setTitle(C.cRed + "Attack Spells")
|
||||
ATTACK(1, 0, 2, new ItemBuilder(Material.INK_SACK, 1, (short) 7).setTitle(C.cRed + "Attack Spells")
|
||||
.addLore(C.cGray + "Spells of destruction").build(), C.cRed),
|
||||
|
||||
MISC(7, 7, 8, new ItemBuilder(Material.COAL_BLOCK).setTitle(C.cDGray + "Misc Spells").addLore(
|
||||
MISC(7, 6, 8, new ItemBuilder(Material.INK_SACK, 1, (short) 11).setTitle(C.cDGray + "Misc Spells").addLore(
|
||||
|
||||
C.cGray + "Misc spells that don't fit in",
|
||||
|
||||
"These spells generally effect the world itself").build(), C.cGray),
|
||||
|
||||
RUNES(3, 3, 3, new ItemBuilder(Material.NETHER_STAR).setTitle(C.cGold + "Rune Spells")
|
||||
.addLore(C.cGray + "Spells for creation of runes").build(), C.cGold),
|
||||
|
||||
SUPPORT(5, 5, 5, new ItemBuilder(Material.IRON_BOOTS).setTitle(C.cDGreen + "Support Spells")
|
||||
SUPPORT(4, 4, 4, new ItemBuilder(Material.INK_SACK, 1, (short) 14).setTitle(C.cDGreen + "Support Spells")
|
||||
.addLore(C.cGray + "Spells of assistance").build(), C.cDGreen);
|
||||
|
||||
private String _chatColor;
|
||||
@ -551,13 +528,59 @@ public enum SpellType // ❤
|
||||
}
|
||||
}
|
||||
|
||||
public enum WandElement
|
||||
{
|
||||
AIR(Material.IRON_HOE),
|
||||
|
||||
DEATH(Material.STICK),
|
||||
|
||||
EARTH(Material.STONE_HOE),
|
||||
|
||||
FIRE(Material.GOLD_HOE),
|
||||
|
||||
ICE(Material.DIAMOND_HOE),
|
||||
|
||||
LIFE(Material.WOOD_HOE);
|
||||
|
||||
private Material _material;
|
||||
|
||||
private WandElement(Material material)
|
||||
{
|
||||
_material = material;
|
||||
}
|
||||
|
||||
public Material getMaterial()
|
||||
{
|
||||
return _material;
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
{
|
||||
for (SpellType spell : values())
|
||||
{
|
||||
spell._slot = 9 + spell.getElement().getFirstSlot();
|
||||
ArrayList<SpellType> spells = new ArrayList<SpellType>(Arrays.asList(SpellType.values()));
|
||||
|
||||
for (SpellType spell2 : values())
|
||||
Collections.sort(spells, new Comparator<SpellType>()
|
||||
{
|
||||
|
||||
@Override
|
||||
public int compare(SpellType o1, SpellType o2)
|
||||
{
|
||||
int number = new Integer(o2.getItemAmount()).compareTo(o1.getItemAmount());
|
||||
|
||||
if (number == 0)
|
||||
{
|
||||
return o1.getSpellName().compareToIgnoreCase(o2.getSpellName());
|
||||
}
|
||||
|
||||
return number;
|
||||
}
|
||||
});
|
||||
|
||||
for (SpellType spell : spells)
|
||||
{
|
||||
spell._slot = 18 + spell.getElement().getFirstSlot();
|
||||
|
||||
for (SpellType spell2 : spells)
|
||||
{
|
||||
if (spell != spell2 && spell.getElement() == spell2.getElement() && spell._slot <= spell2._slot)
|
||||
{
|
||||
@ -610,10 +633,13 @@ public enum SpellType // ❤
|
||||
private int _spellCost;
|
||||
private String _spellName;
|
||||
private SpellElement _type;
|
||||
private WandElement _wandElement;
|
||||
|
||||
private SpellType(SpellElement type, String spellName, ItemStack spellItem, Class<? extends Spell> spell, int maxLevel,
|
||||
int spellCost, int spellCooldown, int manaChangePerLevel, int cooldownChangePerLevel, int itemAmount, String... desc)
|
||||
private SpellType(SpellElement type, WandElement wandElement, String spellName, ItemStack spellItem,
|
||||
Class<? extends Spell> spell, int maxLevel, int spellCost, int spellCooldown, int manaChangePerLevel,
|
||||
int cooldownChangePerLevel, int itemAmount, String... desc)
|
||||
{
|
||||
_wandElement = wandElement;
|
||||
_maxLevel = maxLevel;
|
||||
_item = spellItem;
|
||||
_desc = desc;
|
||||
@ -627,6 +653,16 @@ public enum SpellType // ❤
|
||||
_itemAmount = itemAmount;
|
||||
}
|
||||
|
||||
public int getBaseCooldown()
|
||||
{
|
||||
return _spellCooldown;
|
||||
}
|
||||
|
||||
public int getBaseManaCost()
|
||||
{
|
||||
return _spellCost;
|
||||
}
|
||||
|
||||
public String[] getDesc()
|
||||
{
|
||||
return _desc;
|
||||
@ -642,16 +678,6 @@ public enum SpellType // ❤
|
||||
return _itemAmount;
|
||||
}
|
||||
|
||||
public int getBaseManaCost()
|
||||
{
|
||||
return _spellCost;
|
||||
}
|
||||
|
||||
public int getBaseCooldown()
|
||||
{
|
||||
return _spellCooldown;
|
||||
}
|
||||
|
||||
public int getManaCost(Wizard wizard)
|
||||
{
|
||||
return Math.max(0,
|
||||
@ -677,7 +703,11 @@ public enum SpellType // ❤
|
||||
|
||||
public ItemStack getSpellBook(Wizards wizards)
|
||||
{
|
||||
return makeSpell(wizards, new ItemBuilder(Material.ENCHANTED_BOOK).addLore(C.cAqua + "Click to level up this spell")
|
||||
return makeSpell(wizards,
|
||||
|
||||
new ItemBuilder(_item)
|
||||
|
||||
.addLore(C.cAqua + "Click to level up this spell")
|
||||
|
||||
.build());
|
||||
}
|
||||
@ -710,10 +740,17 @@ public enum SpellType // ❤
|
||||
return _spellName;
|
||||
}
|
||||
|
||||
public WandElement getWandType()
|
||||
{
|
||||
return _wandElement;
|
||||
}
|
||||
|
||||
public ItemStack makeSpell(Wizards wizards, ItemStack item)
|
||||
{
|
||||
ItemBuilder builder = new ItemBuilder(item);
|
||||
|
||||
builder.setTitle(C.cDBlue + C.Bold + "Spell: " + _type._chatColor + getSpellName() + wizards.buildTime());
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
}
|
||||
|
@ -1,106 +1,141 @@
|
||||
package nautilus.game.arcade.game.games.wizards;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
|
||||
public class Wizard
|
||||
{
|
||||
|
||||
private NautHashMap<SpellType, Long> _cooldowns = new NautHashMap<SpellType, Long>();
|
||||
private NautHashMap<SpellType, Integer> _knownSpells = new NautHashMap<SpellType, Integer>();
|
||||
private SpellType[] _assignedWands = new SpellType[5];
|
||||
private float _mana;
|
||||
private float _manaPerTick = 2.5F / 20F;
|
||||
private float _maxMana;
|
||||
private int _soulStars;
|
||||
private float _cooldownModifier = 1;
|
||||
private NautHashMap<SpellType, Long> _cooldowns = new NautHashMap<SpellType, Long>();
|
||||
private NautHashMap<SpellType, Integer> _knownSpells = new NautHashMap<SpellType, Integer>();
|
||||
private SpellType[] _assignedWands = new SpellType[5];
|
||||
private float _mana;
|
||||
private float _manaPerTick = 2.5F / 20F;
|
||||
private float _maxMana;
|
||||
private int _soulStars;
|
||||
private float _cooldownModifier = 1;
|
||||
private int _wandsOwned;
|
||||
|
||||
public float getCooldownModifier()
|
||||
{
|
||||
return _cooldownModifier;
|
||||
}
|
||||
public void setWandsOwned(int wandsOwned)
|
||||
{
|
||||
_wandsOwned = wandsOwned;
|
||||
}
|
||||
|
||||
public void decreaseCooldown()
|
||||
{
|
||||
_cooldownModifier -= 0.1;
|
||||
}
|
||||
public int getWandsOwned()
|
||||
{
|
||||
return _wandsOwned;
|
||||
}
|
||||
|
||||
public void addSoulStar()
|
||||
{
|
||||
_soulStars++;
|
||||
}
|
||||
public float getCooldownModifier()
|
||||
{
|
||||
return _cooldownModifier;
|
||||
}
|
||||
|
||||
public Wizard(float maxMana)
|
||||
{
|
||||
learnSpell(SpellType.MagicMissile);
|
||||
learnSpell(SpellType.WizardsCompass);
|
||||
_maxMana = maxMana;
|
||||
}
|
||||
public void decreaseCooldown()
|
||||
{
|
||||
_cooldownModifier -= 0.1;
|
||||
}
|
||||
|
||||
public SpellType getSpell(int slot)
|
||||
{
|
||||
return _assignedWands[slot];
|
||||
}
|
||||
public void addSoulStar()
|
||||
{
|
||||
_soulStars++;
|
||||
}
|
||||
|
||||
public void setSpell(int slot, SpellType spell)
|
||||
{
|
||||
_assignedWands[slot] = spell;
|
||||
}
|
||||
public Wizard(float maxMana)
|
||||
{
|
||||
learnSpell(SpellType.ManaBolt);
|
||||
learnSpell(SpellType.WizardsCompass);
|
||||
|
||||
public long getCooldown(SpellType type)
|
||||
{
|
||||
if (_cooldowns.containsKey(type) && _cooldowns.get(type) >= System.currentTimeMillis())
|
||||
{
|
||||
return _cooldowns.get(type);
|
||||
}
|
||||
_maxMana = maxMana;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
public SpellType getSpell(int slot)
|
||||
{
|
||||
return _assignedWands[slot];
|
||||
}
|
||||
|
||||
public float getMana()
|
||||
{
|
||||
return _mana;
|
||||
}
|
||||
public void setSpell(int slot, SpellType spell)
|
||||
{
|
||||
_assignedWands[slot] = spell;
|
||||
}
|
||||
|
||||
public float getManaPerTick()
|
||||
{
|
||||
return _manaPerTick + ((_soulStars * 0.1F) / 20);
|
||||
}
|
||||
public long getCooldown(SpellType type)
|
||||
{
|
||||
if (_cooldowns.containsKey(type) && _cooldowns.get(type) >= System.currentTimeMillis())
|
||||
{
|
||||
return _cooldowns.get(type);
|
||||
}
|
||||
|
||||
public float getMaxMana()
|
||||
{
|
||||
return _maxMana;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getSpellLevel(SpellType type)
|
||||
{
|
||||
if (_knownSpells.containsKey(type))
|
||||
{
|
||||
return _knownSpells.get(type);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
public float getMana()
|
||||
{
|
||||
return _mana;
|
||||
}
|
||||
|
||||
public void learnSpell(SpellType type)
|
||||
{
|
||||
_knownSpells.put(type, getSpellLevel(type) + 1);
|
||||
}
|
||||
public float getManaPerTick()
|
||||
{
|
||||
return _manaPerTick + ((_soulStars * 0.2F) / 20);
|
||||
}
|
||||
|
||||
public void setMana(float newMana)
|
||||
{
|
||||
_mana = newMana;
|
||||
}
|
||||
public float getMaxMana()
|
||||
{
|
||||
return _maxMana;
|
||||
}
|
||||
|
||||
public void setUsedSpell(SpellType spell)
|
||||
{
|
||||
int cooldown = spell.getSpellCooldown(this);
|
||||
if (cooldown > 0)
|
||||
{
|
||||
_cooldowns.put(spell, System.currentTimeMillis() + (1000L * cooldown));
|
||||
}
|
||||
}
|
||||
public int getSpellLevel(SpellType type)
|
||||
{
|
||||
if (_knownSpells.containsKey(type))
|
||||
{
|
||||
return _knownSpells.get(type);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void setManaPerTick(float manaPerTick)
|
||||
{
|
||||
_manaPerTick = manaPerTick;
|
||||
}
|
||||
public void learnSpell(SpellType type)
|
||||
{
|
||||
_knownSpells.put(type, getSpellLevel(type) + 1);
|
||||
}
|
||||
|
||||
public void addMana(float newMana)
|
||||
{
|
||||
_mana += newMana;
|
||||
|
||||
if (_mana > _maxMana)
|
||||
{
|
||||
_mana = _maxMana;
|
||||
}
|
||||
}
|
||||
|
||||
public void setMana(float newMana)
|
||||
{
|
||||
_mana = newMana;
|
||||
}
|
||||
|
||||
public void setUsedSpell(SpellType spell)
|
||||
{
|
||||
int cooldown = spell.getSpellCooldown(this);
|
||||
|
||||
if (cooldown > 0)
|
||||
{
|
||||
_cooldowns.put(spell, System.currentTimeMillis() + (1000L * cooldown));
|
||||
}
|
||||
}
|
||||
|
||||
public NautHashMap<SpellType, Long> getCooldowns()
|
||||
{
|
||||
return _cooldowns;
|
||||
}
|
||||
|
||||
public void setManaPerTick(float manaPerTick)
|
||||
{
|
||||
_manaPerTick = manaPerTick;
|
||||
}
|
||||
|
||||
public Set<SpellType> getKnownSpells()
|
||||
{
|
||||
return _knownSpells.keySet();
|
||||
}
|
||||
}
|
||||
|
@ -20,93 +20,89 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class WizardSpellMenu extends MiniPlugin
|
||||
{
|
||||
private Wizards _wizards;
|
||||
private WizardSpellMenuShop _wizardShop;
|
||||
private ItemStack _wizardSpells = new ItemBuilder(Material.ENCHANTED_BOOK).setTitle(C.cGold + "Wizard Spells")
|
||||
.addLore(C.cGray + "Right click with this to view the spells").build();
|
||||
private Wizards _wizards;
|
||||
private WizardSpellMenuShop _wizardShop;
|
||||
private ItemStack _wizardSpells = new ItemBuilder(Material.ENCHANTED_BOOK).setTitle(C.cGold + "Wizard Spells")
|
||||
.addLore(C.cGray + "Right click with this to view the spells").build();
|
||||
|
||||
public WizardSpellMenu(String moduleName, JavaPlugin plugin, Wizards wizards)
|
||||
{
|
||||
super("Wizard Spell Menu", plugin);
|
||||
_wizardShop = new WizardSpellMenuShop(this, wizards.getArcadeManager().GetClients(), wizards.getArcadeManager()
|
||||
.GetDonation(), wizards);
|
||||
_wizards = wizards;
|
||||
}
|
||||
public WizardSpellMenu(String moduleName, JavaPlugin plugin, Wizards wizards)
|
||||
{
|
||||
super("Wizard Spell Menu", plugin);
|
||||
_wizardShop = new WizardSpellMenuShop(this, wizards.getArcadeManager().GetClients(), wizards.getArcadeManager()
|
||||
.GetDonation(), wizards);
|
||||
_wizards = wizards;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onJoin(PlayerJoinEvent event)
|
||||
{
|
||||
@EventHandler
|
||||
public void onJoin(PlayerJoinEvent event)
|
||||
{
|
||||
if (_wizards.GetState() == GameState.Recruit || _wizards.GetState() == GameState.Live)
|
||||
{
|
||||
event.getPlayer().getInventory().setItem(0, _wizardSpells);
|
||||
}
|
||||
}
|
||||
|
||||
if (_wizards.GetState() == GameState.Recruit || _wizards.GetState() == GameState.Live)
|
||||
{
|
||||
event.getPlayer().getInventory().addItem(_wizardSpells);
|
||||
}
|
||||
}
|
||||
@EventHandler
|
||||
public void onDeath(final PlayerDeathEvent event)
|
||||
{
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(_plugin, new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
if (_wizards.IsLive())
|
||||
{
|
||||
event.getEntity().getInventory().setItem(0, _wizardSpells);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDeath(final PlayerDeathEvent event)
|
||||
{
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(_plugin, new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
if (_wizards.IsLive())
|
||||
{
|
||||
event.getEntity().getInventory().addItem(_wizardSpells);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@EventHandler
|
||||
public void onJoin(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() == GameState.Recruit)
|
||||
{
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
player.getInventory().setItem(0, _wizardSpells);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onJoin(GameStateChangeEvent event)
|
||||
{
|
||||
@EventHandler
|
||||
public void onInteract(PlayerInteractEvent event)
|
||||
{
|
||||
if (event.getAction() != Action.PHYSICAL && event.getAction().name().contains("RIGHT")
|
||||
&& (!_wizards.IsLive() || !_wizards.IsAlive(event.getPlayer())))
|
||||
{
|
||||
|
||||
if (event.GetState() == GameState.Recruit)
|
||||
{
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
player.getInventory().addItem(_wizardSpells);
|
||||
}
|
||||
}
|
||||
}
|
||||
ItemStack item = event.getItem();
|
||||
|
||||
@EventHandler
|
||||
public void onInteract(PlayerInteractEvent event)
|
||||
{
|
||||
if (event.getAction() != Action.PHYSICAL && (!_wizards.IsLive() || !_wizards.IsAlive(event.getPlayer())))
|
||||
{
|
||||
if (item != null && item.isSimilar(_wizardSpells))
|
||||
{
|
||||
|
||||
ItemStack item = event.getItem();
|
||||
_wizardShop.attemptShopOpen(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
if (item != null && item.isSimilar(_wizardSpells))
|
||||
{
|
||||
if (_wizards.IsLive() && _wizards.IsAlive(event.getPlayer()))
|
||||
{
|
||||
Player p = event.getPlayer();
|
||||
|
||||
_wizardShop.attemptShopOpen(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
if (_wizards.IsLive() && _wizards.IsAlive(event.getPlayer()))
|
||||
{
|
||||
|
||||
ItemStack item = event.getItem();
|
||||
if (item != null && item.getType() == Material.BLAZE_ROD)
|
||||
{
|
||||
|
||||
Player p = event.getPlayer();
|
||||
|
||||
if (event.getAction().name().contains("RIGHT"))
|
||||
{
|
||||
if (p.getInventory().getHeldItemSlot() < 5)
|
||||
{
|
||||
if (event.getClickedBlock() == null || !(event.getClickedBlock().getState() instanceof InventoryHolder))
|
||||
{
|
||||
_wizardShop.attemptShopOpen(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (p.getInventory().getHeldItemSlot() < _wizards.getWizard(p).getWandsOwned())
|
||||
{
|
||||
if (event.getAction().name().contains("RIGHT"))
|
||||
{
|
||||
if (p.getInventory().getHeldItemSlot() < 5)
|
||||
{
|
||||
if (event.getClickedBlock() == null || !(event.getClickedBlock().getState() instanceof InventoryHolder))
|
||||
{
|
||||
_wizardShop.attemptShopOpen(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,26 +10,26 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class WizardSpellMenuShop extends ShopBase<WizardSpellMenu>
|
||||
{
|
||||
private Wizards _wizards;
|
||||
private Wizards _wizards;
|
||||
|
||||
public WizardSpellMenuShop(WizardSpellMenu plugin, CoreClientManager clientManager, DonationManager donationManager,
|
||||
Wizards wizard, CurrencyType... currencyTypes)
|
||||
{
|
||||
super(plugin, clientManager, donationManager, "Kit Evolve Menu", currencyTypes);
|
||||
_wizards = wizard;
|
||||
}
|
||||
public WizardSpellMenuShop(WizardSpellMenu plugin, CoreClientManager clientManager, DonationManager donationManager,
|
||||
Wizards wizard, CurrencyType... currencyTypes)
|
||||
{
|
||||
super(plugin, clientManager, donationManager, "Kit Evolve Menu", currencyTypes);
|
||||
_wizards = wizard;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ShopPageBase<WizardSpellMenu, ? extends ShopBase<WizardSpellMenu>> buildPagesFor(Player player)
|
||||
{
|
||||
return new SpellMenuPage(getPlugin(), this, getClientManager(), getDonationManager(), player, _wizards);
|
||||
}
|
||||
@Override
|
||||
protected ShopPageBase<WizardSpellMenu, ? extends ShopBase<WizardSpellMenu>> buildPagesFor(Player player)
|
||||
{
|
||||
return new SpellMenuPage(getPlugin(), this, getClientManager(), getDonationManager(), player, _wizards);
|
||||
}
|
||||
|
||||
public void update()
|
||||
{
|
||||
for (ShopPageBase<WizardSpellMenu, ? extends ShopBase<WizardSpellMenu>> shopPage : getPlayerPageMap().values())
|
||||
{
|
||||
shopPage.refresh();
|
||||
}
|
||||
}
|
||||
public void update()
|
||||
{
|
||||
for (ShopPageBase<WizardSpellMenu, ? extends ShopBase<WizardSpellMenu>> shopPage : getPlayerPageMap().values())
|
||||
{
|
||||
shopPage.refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,5 @@
|
||||
package nautilus.game.arcade.game.games.wizards.kit;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.wizards.Wizards;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
@ -15,35 +13,17 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class KitMage extends Kit
|
||||
{
|
||||
public KitMage(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Mage", KitAvailability.Free, new String[]
|
||||
{
|
||||
"Start with two extra spells"
|
||||
}, new Perk[0], EntityType.WITCH, new ItemStack(Material.BLAZE_ROD));
|
||||
}
|
||||
public KitMage(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Mage", KitAvailability.Free, new String[]
|
||||
{
|
||||
"Start with two extra spells"
|
||||
}, new Perk[0], EntityType.WITCH, new ItemStack(Material.BLAZE_ROD));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
if (i < 2)
|
||||
{
|
||||
player.getInventory().addItem(((Wizards) Manager.GetGame()).makeUnusedWand());
|
||||
}
|
||||
else
|
||||
{
|
||||
player.getInventory().addItem(
|
||||
|
||||
new ItemBuilder(Material.STAINED_GLASS_PANE, 1, (short) 8)
|
||||
|
||||
.setTitle(C.cGray + "Empty wand slot" + ((Wizards) Manager.GetGame()).buildTime())
|
||||
|
||||
.addLore(C.cGray + C.Italics + "Wands can be found in chests and on dead players")
|
||||
|
||||
.build());
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
((Wizards) this.Manager.GetGame()).setupWizard(player);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
package nautilus.game.arcade.game.games.wizards.kit;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.wizards.Wizards;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
@ -15,35 +13,17 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class KitMystic extends Kit
|
||||
{
|
||||
public KitMystic(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Mystic", KitAvailability.Free, new String[]
|
||||
{
|
||||
"Mana regeneration increased by 10%"
|
||||
}, new Perk[0], EntityType.WITCH, new ItemStack(Material.BLAZE_ROD));
|
||||
}
|
||||
public KitMystic(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Mystic", KitAvailability.Free, new String[]
|
||||
{
|
||||
"Mana regeneration increased by 10%"
|
||||
}, new Perk[0], EntityType.WITCH, new ItemStack(Material.WOOD_HOE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
if (i < 2)
|
||||
{
|
||||
player.getInventory().addItem(((Wizards) Manager.GetGame()).makeUnusedWand());
|
||||
}
|
||||
else
|
||||
{
|
||||
player.getInventory().addItem(
|
||||
|
||||
new ItemBuilder(Material.STAINED_GLASS_PANE, 1, (short) 8)
|
||||
|
||||
.setTitle(C.cGray + "Empty wand slot" + ((Wizards) Manager.GetGame()).buildTime())
|
||||
|
||||
.addLore(C.cGray + C.Italics + "Wands can be found in chests and on dead players")
|
||||
|
||||
.build());
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
((Wizards) this.Manager.GetGame()).setupWizard(player);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
package nautilus.game.arcade.game.games.wizards.kit;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.wizards.Wizards;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
@ -15,35 +13,17 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class KitSorcerer extends Kit
|
||||
{
|
||||
public KitSorcerer(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Sorcerer", KitAvailability.Free, new String[]
|
||||
{
|
||||
"Start out with an extra wand"
|
||||
}, new Perk[0], EntityType.WITCH, new ItemStack(Material.BLAZE_ROD));
|
||||
}
|
||||
public KitSorcerer(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Sorcerer", KitAvailability.Free, new String[]
|
||||
{
|
||||
"Start out with an extra wand"
|
||||
}, new Perk[0], EntityType.WITCH, new ItemStack(Material.STONE_HOE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
if (i < 3)
|
||||
{
|
||||
player.getInventory().addItem(((Wizards) Manager.GetGame()).makeUnusedWand());
|
||||
}
|
||||
else
|
||||
{
|
||||
player.getInventory().addItem(
|
||||
|
||||
new ItemBuilder(Material.STAINED_GLASS_PANE, 1, (short) 8)
|
||||
|
||||
.setTitle(C.cGray + "Empty wand slot" + ((Wizards) Manager.GetGame()).buildTime())
|
||||
|
||||
.addLore(C.cGray + C.Italics + "Wands can be found in chests and on dead players")
|
||||
|
||||
.build());
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
((Wizards) this.Manager.GetGame()).setupWizard(player);
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
package nautilus.game.arcade.game.games.wizards.kit;
|
||||
|
||||
import mineplex.core.achievement.Achievement;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.wizards.Wizards;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
@ -16,40 +14,22 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class KitWitchDoctor extends Kit
|
||||
{
|
||||
public KitWitchDoctor(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Witch Doctor", KitAvailability.Free, new String[]
|
||||
{
|
||||
"Max mana increased to 150"
|
||||
}, new Perk[0], EntityType.WITCH, new ItemStack(Material.BLAZE_ROD));
|
||||
public KitWitchDoctor(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Witch Doctor", KitAvailability.Free, new String[]
|
||||
{
|
||||
"Max mana increased to 150"
|
||||
}, new Perk[0], EntityType.WITCH, new ItemStack(Material.IRON_HOE));
|
||||
|
||||
this.setAchievementRequirements(new Achievement[]
|
||||
{
|
||||
Achievement.BACON_BRAWL_WINS
|
||||
});
|
||||
}
|
||||
this.setAchievementRequirements(new Achievement[]
|
||||
{
|
||||
Achievement.BACON_BRAWL_WINS
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
if (i < 2)
|
||||
{
|
||||
player.getInventory().addItem(((Wizards) Manager.GetGame()).makeUnusedWand());
|
||||
}
|
||||
else
|
||||
{
|
||||
player.getInventory().addItem(
|
||||
|
||||
new ItemBuilder(Material.STAINED_GLASS_PANE, 1, (short) 8)
|
||||
|
||||
.setTitle(C.cGray + "Empty wand slot" + ((Wizards) Manager.GetGame()).buildTime())
|
||||
|
||||
.addLore(C.cGray + C.Italics + "Wands can be found in chests and on dead players")
|
||||
|
||||
.build());
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
((Wizards) this.Manager.GetGame()).setupWizard(player);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,138 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.minecraft.game.core.explosion.CustomExplosion;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
public class SpellAnvilDrop extends Spell implements SpellClick
|
||||
{
|
||||
private ArrayList<FallingBlock> _fallingBlocks = new ArrayList<FallingBlock>();
|
||||
|
||||
@Override
|
||||
public void castSpell(Player player)
|
||||
{
|
||||
ArrayList<Player> players = new ArrayList<Player>();
|
||||
players.add(player);
|
||||
int radius = 4 + (getSpellLevel(player) * 2);
|
||||
|
||||
for (Entity entity : player.getNearbyEntities(radius, radius * 3, radius))
|
||||
{
|
||||
if (entity instanceof Player && Wizards.IsAlive(entity))
|
||||
{
|
||||
players.add((Player) entity);
|
||||
}
|
||||
}
|
||||
|
||||
ArrayList<FallingBlock> newFallingBlocks = new ArrayList<FallingBlock>();
|
||||
|
||||
for (Player p : players)
|
||||
{
|
||||
UtilParticle.PlayParticle(ParticleType.LARGE_SMOKE, p.getLocation(), 0, 0, 0, 0, 1);
|
||||
|
||||
Location loc = p.getLocation().clone().add(0, 15 + (getSpellLevel(player) * 3), 0);
|
||||
int lowered = 0;
|
||||
|
||||
while (lowered < 5 && loc.getBlock().getType() != Material.AIR)
|
||||
{
|
||||
lowered++;
|
||||
loc = loc.add(0, -1, 0);
|
||||
}
|
||||
|
||||
if (loc.getBlock().getType() == Material.AIR)
|
||||
{
|
||||
|
||||
FallingBlock anvil = p.getWorld().spawnFallingBlock(loc.getBlock().getLocation().add(0.5, 0.5, 0.5),
|
||||
Material.ANVIL, (byte) 0);
|
||||
|
||||
anvil.setMetadata("SpellLevel", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(),
|
||||
getSpellLevel(player)));
|
||||
|
||||
anvil.setMetadata("Wizard", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), player));
|
||||
|
||||
anvil.getWorld().playSound(anvil.getLocation(), Sound.ANVIL_USE, 1.9F, 0);
|
||||
|
||||
newFallingBlocks.add(anvil);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!newFallingBlocks.isEmpty())
|
||||
{
|
||||
_fallingBlocks.addAll(newFallingBlocks);
|
||||
charge(player);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleAnvil(Entity entity)
|
||||
{
|
||||
_fallingBlocks.remove(entity);
|
||||
|
||||
int spellLevel = entity.getMetadata("SpellLevel").get(0).asInt();
|
||||
|
||||
CustomExplosion explosion = new CustomExplosion(Wizards.getArcadeManager().GetDamage(), Wizards.getArcadeManager()
|
||||
.GetExplosion(), entity.getLocation(), 1 + (spellLevel / 2F), "Anvil Drop");
|
||||
|
||||
explosion.setPlayer((Player) entity.getMetadata("Wizard").get(0).value(), true);
|
||||
|
||||
explosion.setFallingBlockExplosion(true);
|
||||
|
||||
explosion.setDropItems(false);
|
||||
|
||||
explosion.setMaxDamage(6 + (spellLevel * 4));
|
||||
|
||||
explosion.explode();
|
||||
|
||||
entity.remove();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDrop(ItemSpawnEvent event)
|
||||
{
|
||||
Iterator<FallingBlock> itel = _fallingBlocks.iterator();
|
||||
FallingBlock b = null;
|
||||
|
||||
while (itel.hasNext())
|
||||
{
|
||||
FallingBlock block = itel.next();
|
||||
|
||||
if (block.isDead())
|
||||
{
|
||||
b = block;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (b != null)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
handleAnvil(b);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlace(EntityChangeBlockEvent event)
|
||||
{
|
||||
if (_fallingBlocks.contains(event.getEntity()))
|
||||
{
|
||||
handleAnvil(event.getEntity());
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,102 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilShapes;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClickBlock;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class SpellBridge extends Spell implements SpellClickBlock
|
||||
{
|
||||
final BlockFace[] radial =
|
||||
{
|
||||
BlockFace.SOUTH, BlockFace.SOUTH_WEST, BlockFace.WEST, BlockFace.NORTH_WEST, BlockFace.NORTH,
|
||||
BlockFace.NORTH_EAST, BlockFace.EAST, BlockFace.SOUTH_EAST
|
||||
};
|
||||
private HashMap<Block, Long> _wallExpires = new HashMap<Block, Long>();
|
||||
|
||||
@EventHandler
|
||||
public void onUpdate(UpdateEvent event)
|
||||
{
|
||||
Iterator<Entry<Block, Long>> itel = _wallExpires.entrySet().iterator();
|
||||
|
||||
while (itel.hasNext())
|
||||
{
|
||||
Entry<Block, Long> entry = itel.next();
|
||||
|
||||
if (entry.getValue() < System.currentTimeMillis())
|
||||
{
|
||||
itel.remove();
|
||||
|
||||
if (entry.getKey().getType() == Material.DIRT)
|
||||
{
|
||||
entry.getKey().setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void castSpell(Player p, final Block target)
|
||||
{
|
||||
final BlockFace facing = radial[Math.round(p.getEyeLocation().getYaw() / 45f) & 0x7];
|
||||
|
||||
p.getWorld().playEffect(target.getLocation(), Effect.STEP_SOUND, Material.DIRT.getId());
|
||||
|
||||
final int maxDist = 10 * getSpellLevel(p);
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
Block block = target;
|
||||
int blocks = 0;
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (!Wizards.IsLive() || blocks++ >= maxDist)
|
||||
{
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
block = block.getRelative(facing);
|
||||
Block bs[] = UtilShapes.getSideBlocks(block, facing);
|
||||
|
||||
bs = new Block[]
|
||||
{
|
||||
bs[0], bs[1], block
|
||||
};
|
||||
|
||||
for (Block b : bs)
|
||||
{
|
||||
if (UtilBlock.solid(b))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
b.setType(Material.DIRT);
|
||||
b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, b.getTypeId());
|
||||
|
||||
_wallExpires.put(b, System.currentTimeMillis() + ((20 + UtilMath.r(10)) * 1000L));
|
||||
}
|
||||
|
||||
}
|
||||
}.runTaskTimer(Wizards.getArcadeManager().getPlugin(), 5, 1);
|
||||
|
||||
charge(p);
|
||||
}
|
||||
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.Wizard;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClickEntity;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class SpellDrain extends Spell implements SpellClickEntity
|
||||
{
|
||||
|
||||
@Override
|
||||
public void castSpell(Player player, Entity entity)
|
||||
{
|
||||
if (entity instanceof Player)
|
||||
{
|
||||
if (Wizards.IsAlive(entity))
|
||||
{
|
||||
|
||||
Wizard wiz = Wizards.getWizard((Player) entity);
|
||||
|
||||
if (wiz.getMana() > 10)
|
||||
{
|
||||
wiz.setMana(0);
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.WITHER_SPAWN, 1, 0);
|
||||
|
||||
charge(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,128 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
import mineplex.minecraft.game.core.explosion.CustomExplosion;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
public class SpellDroom extends Spell implements SpellClick
|
||||
{
|
||||
private ArrayList<FallingBlock> _fallingBlocks = new ArrayList<FallingBlock>();
|
||||
|
||||
@Override
|
||||
public void castSpell(Player player)
|
||||
{
|
||||
ArrayList<Player> players = new ArrayList<Player>();
|
||||
players.add(player);
|
||||
int radius = 4 + (getSpellLevel(player) * 2);
|
||||
|
||||
for (Entity entity : player.getNearbyEntities(radius, radius * 3, radius))
|
||||
{
|
||||
if (entity instanceof Player && Wizards.IsAlive(entity))
|
||||
{
|
||||
players.add((Player) entity);
|
||||
}
|
||||
}
|
||||
|
||||
ArrayList<FallingBlock> newFallingBlocks = new ArrayList<FallingBlock>();
|
||||
|
||||
for (Player p : players)
|
||||
{
|
||||
Location loc = p.getLocation().clone().add(0, 15 + (getSpellLevel(player) * 3), 0);
|
||||
int lowered = 0;
|
||||
|
||||
while (lowered < 5 && loc.getBlock().getType() != Material.AIR)
|
||||
{
|
||||
lowered++;
|
||||
loc = loc.add(0, -1, 0);
|
||||
}
|
||||
|
||||
if (loc.getBlock().getType() == Material.AIR)
|
||||
{
|
||||
|
||||
FallingBlock anvil = p.getWorld().spawnFallingBlock(loc.getBlock().getLocation().add(0.5, 0.5, 0.5),
|
||||
Material.ANVIL, (byte) 0);
|
||||
|
||||
anvil.setMetadata("ExplosionSize", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(),
|
||||
1 + (getSpellLevel(player) / 2F)));
|
||||
|
||||
anvil.setMetadata("Wizard", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), player));
|
||||
|
||||
anvil.getWorld().playSound(anvil.getLocation(), Sound.ANVIL_USE, 1.9F, 0);
|
||||
|
||||
newFallingBlocks.add(anvil);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!newFallingBlocks.isEmpty())
|
||||
{
|
||||
_fallingBlocks.addAll(newFallingBlocks);
|
||||
charge(player);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleAnvil(Entity entity)
|
||||
{
|
||||
_fallingBlocks.remove(entity);
|
||||
|
||||
CustomExplosion explosion = new CustomExplosion(Wizards.getArcadeManager().GetDamage(), entity.getLocation(),
|
||||
(float) entity.getMetadata("ExplosionSize").get(0).asDouble(), "Droom");
|
||||
|
||||
explosion.setPlayer((Player) entity.getMetadata("Wizard").get(0).value(), true);
|
||||
|
||||
explosion.setDropItems(false);
|
||||
|
||||
explosion.explode();
|
||||
|
||||
entity.remove();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDrop(ItemSpawnEvent event)
|
||||
{
|
||||
Iterator<FallingBlock> itel = _fallingBlocks.iterator();
|
||||
FallingBlock b = null;
|
||||
|
||||
while (itel.hasNext())
|
||||
{
|
||||
FallingBlock block = itel.next();
|
||||
|
||||
if (block.isDead())
|
||||
{
|
||||
b = block;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (b != null)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
handleAnvil(b);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlace(EntityChangeBlockEvent event)
|
||||
{
|
||||
if (_fallingBlocks.contains(event.getEntity()))
|
||||
{
|
||||
handleAnvil(event.getEntity());
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spells.subclasses.ExplosiveRune;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class SpellExplosiveRune extends Spell implements SpellClick
|
||||
{
|
||||
private ArrayList<ExplosiveRune> _explosiveRunes = new ArrayList<ExplosiveRune>();
|
||||
|
||||
@Override
|
||||
public void castSpell(Player p)
|
||||
{
|
||||
Vector vector = p.getEyeLocation().getDirection();
|
||||
vector.normalize().multiply(0.5);
|
||||
|
||||
float trapSize = Math.max(1, 1 + getSpellLevel(p));
|
||||
|
||||
List<Block> list = p.getLastTwoTargetBlocks(UtilBlock.blockAirFoliageSet, (int) ((trapSize * 4) + 12));
|
||||
|
||||
if (list.size() > 1)
|
||||
{
|
||||
Location loc = list.get(0).getLocation().add(0.5, 0, 0.5);
|
||||
|
||||
ExplosiveRune rune = new ExplosiveRune(Wizards.getArcadeManager().GetDamage(), loc, p, trapSize);
|
||||
|
||||
if (!isValid(rune))
|
||||
{
|
||||
p.sendMessage(C.cGreen + "Cannot draw rune on wall");
|
||||
return;
|
||||
}
|
||||
|
||||
_explosiveRunes.add(rune);
|
||||
charge(p);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onTick(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() == UpdateType.TICK)
|
||||
{
|
||||
Iterator<ExplosiveRune> itel = _explosiveRunes.iterator();
|
||||
|
||||
while (itel.hasNext())
|
||||
{
|
||||
|
||||
ExplosiveRune rune = itel.next();
|
||||
|
||||
if (rune.onTick())
|
||||
{
|
||||
itel.remove();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isValid(ExplosiveRune rune)
|
||||
{
|
||||
return !UtilBlock.solid(rune.getLocation().getBlock())
|
||||
|| UtilBlock.solid(rune.getLocation().getBlock().getRelative(BlockFace.DOWN));
|
||||
}
|
||||
}
|
@ -18,49 +18,53 @@ import org.bukkit.util.Vector;
|
||||
public class SpellFireball extends Spell implements SpellClick
|
||||
{
|
||||
|
||||
@EventHandler
|
||||
public void onHit(ProjectileHitEvent event)
|
||||
{
|
||||
Projectile projectile = event.getEntity();
|
||||
if (projectile.hasMetadata("FireballSpell"))
|
||||
{
|
||||
projectile.remove();
|
||||
@EventHandler
|
||||
public void onHit(ProjectileHitEvent event)
|
||||
{
|
||||
Projectile projectile = event.getEntity();
|
||||
|
||||
CustomExplosion explosion = new CustomExplosion(Wizards.getArcadeManager().GetDamage(), projectile.getLocation(),
|
||||
projectile.getMetadata("FireballYield").get(0).asFloat(), "Fireball");
|
||||
if (projectile.hasMetadata("FireballSpell"))
|
||||
{
|
||||
projectile.remove();
|
||||
|
||||
explosion.setPlayer((Player) projectile.getMetadata("FireballSpell").get(0).value(), true);
|
||||
int spellLevel = projectile.getMetadata("SpellLevel").get(0).asInt();
|
||||
|
||||
explosion.setDropItems(false);
|
||||
CustomExplosion explosion = new CustomExplosion(Wizards.getArcadeManager().GetDamage(), Wizards.getArcadeManager()
|
||||
.GetExplosion(), projectile.getLocation(), (spellLevel * 0.3F) + 1F, "Fireball");
|
||||
|
||||
explosion.explode();
|
||||
explosion.setPlayer((Player) projectile.getMetadata("FireballSpell").get(0).value(), true);
|
||||
|
||||
}
|
||||
}
|
||||
explosion.setFallingBlockExplosion(true);
|
||||
|
||||
@Override
|
||||
public void castSpell(Player p)
|
||||
{
|
||||
org.bukkit.entity.Fireball fireball = (org.bukkit.entity.Fireball) p.getWorld().spawnEntity(p.getEyeLocation(),
|
||||
EntityType.FIREBALL);
|
||||
explosion.setDropItems(false);
|
||||
|
||||
Vector vector = p.getEyeLocation().getDirection().normalize().multiply(0.14);
|
||||
explosion.setMaxDamage(spellLevel + 6);
|
||||
|
||||
// We can't call the bukkit methods because for some weird reason, it enforces a certain speed.
|
||||
EntityFireball eFireball = ((CraftFireball) fireball).getHandle();
|
||||
eFireball.dirX = vector.getX();
|
||||
eFireball.dirY = vector.getY();
|
||||
eFireball.dirZ = vector.getZ();
|
||||
explosion.explode();
|
||||
}
|
||||
}
|
||||
|
||||
fireball.setBounce(false);
|
||||
fireball.setShooter(p);
|
||||
fireball.setYield(0);
|
||||
fireball.setMetadata("FireballSpell", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), p));
|
||||
fireball.setMetadata("FireballYield", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(),
|
||||
(getSpellLevel(p) * 0.25F) + 0.8F));
|
||||
@Override
|
||||
public void castSpell(Player p)
|
||||
{
|
||||
org.bukkit.entity.Fireball fireball = (org.bukkit.entity.Fireball) p.getWorld().spawnEntity(p.getEyeLocation(),
|
||||
EntityType.FIREBALL);
|
||||
|
||||
p.getWorld().playSound(p.getLocation(), Sound.BLAZE_BREATH, 0.5F, 5F);
|
||||
charge(p);
|
||||
}
|
||||
Vector vector = p.getEyeLocation().getDirection().normalize().multiply(0.14);
|
||||
|
||||
// We can't call the bukkit methods because for some weird reason, it enforces a certain speed.
|
||||
EntityFireball eFireball = ((CraftFireball) fireball).getHandle();
|
||||
eFireball.dirX = vector.getX();
|
||||
eFireball.dirY = vector.getY();
|
||||
eFireball.dirZ = vector.getZ();
|
||||
|
||||
fireball.setBounce(false);
|
||||
fireball.setShooter(p);
|
||||
fireball.setYield(0);
|
||||
fireball.setMetadata("FireballSpell", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), p));
|
||||
fireball.setMetadata("SpellLevel", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), getSpellLevel(p)));
|
||||
|
||||
p.getWorld().playSound(p.getLocation(), Sound.BLAZE_BREATH, 0.5F, 5F);
|
||||
charge(p);
|
||||
}
|
||||
}
|
||||
|
@ -1,48 +1,69 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class SpellFlash extends Spell implements SpellClick
|
||||
{
|
||||
@Override
|
||||
public void castSpell(Player player)
|
||||
{
|
||||
int maxTeleportDistance = 20 + (10 * getSpellLevel(player));
|
||||
|
||||
List<Block> list = player.getLastTwoTargetBlocks(UtilBlock.blockAirFoliageSet, maxTeleportDistance);
|
||||
|
||||
if (list.size() > 1 && list.get(1).getType() != Material.AIR)
|
||||
{
|
||||
Block b = list.get(0);
|
||||
|
||||
if (b.getLocation().distance(player.getLocation()) > 2)
|
||||
{
|
||||
|
||||
Location loc = b.getLocation().clone().add(0.5, 0.5, 0.5);
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1, 1.2F);
|
||||
player.getWorld().playEffect(player.getLocation(), Effect.ENDER_SIGNAL, 9);
|
||||
|
||||
player.setFallDistance(0);
|
||||
player.teleport(loc);
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1, 1.2F);
|
||||
player.getWorld().playEffect(player.getLocation(), Effect.ENDER_SIGNAL, 9);
|
||||
|
||||
charge(player);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void castSpell(Player player)
|
||||
{
|
||||
int maxRange = 20 + (10 * getSpellLevel(player));
|
||||
|
||||
double curRange = 0;
|
||||
|
||||
while (curRange <= maxRange)
|
||||
{
|
||||
Location newTarget = player.getEyeLocation().add(new Vector(0, 0.2, 0))
|
||||
.add(player.getLocation().getDirection().multiply(curRange));
|
||||
|
||||
if (!UtilBlock.airFoliage(newTarget.getBlock())
|
||||
|| !UtilBlock.airFoliage(newTarget.getBlock().getRelative(BlockFace.UP)))
|
||||
break;
|
||||
|
||||
// Progress Forwards
|
||||
curRange += 0.2;
|
||||
|
||||
// Smoke Trail
|
||||
UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, newTarget.clone().add(0, 0.5, 0), 0, 0, 0, 0, 1);
|
||||
}
|
||||
|
||||
// Modify Range
|
||||
curRange -= 0.4;
|
||||
if (curRange < 0)
|
||||
curRange = 0;
|
||||
|
||||
// Destination
|
||||
Location loc = player.getEyeLocation().add(new Vector(0, 0.2, 0))
|
||||
.add(player.getLocation().getDirection().multiply(curRange)).add(new Vector(0, 0.4, 0));
|
||||
|
||||
if (curRange > 0)
|
||||
{
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1, 1.2F);
|
||||
player.getWorld().playEffect(player.getLocation(), Effect.ENDER_SIGNAL, 9);
|
||||
|
||||
player.setFallDistance(0);
|
||||
|
||||
player.eject();
|
||||
player.leaveVehicle();
|
||||
|
||||
player.teleport(loc);
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1, 1.2F);
|
||||
player.getWorld().playEffect(player.getLocation(), Effect.ENDER_SIGNAL, 9);
|
||||
|
||||
charge(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,140 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilShapes;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClickBlock;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockFadeEvent;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class SpellFrostBarrier extends Spell implements SpellClick, SpellClickBlock
|
||||
{
|
||||
private HashMap<Block, Long> _wallExpires = new HashMap<Block, Long>();
|
||||
|
||||
@Override
|
||||
public void castSpell(Player player)
|
||||
{
|
||||
Location loc = player.getLocation().add(player.getLocation().getDirection().setY(0).normalize().multiply(1.5));
|
||||
|
||||
castSpell(player, loc.getBlock().getRelative(BlockFace.DOWN));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void castSpell(Player player, Block block)
|
||||
{
|
||||
final Block starter = block.getRelative(BlockFace.UP);
|
||||
final int wallWidth = 4 + (getSpellLevel(player) * 2);
|
||||
final BlockFace facing = UtilShapes.getFacing(player.getEyeLocation().getYaw());
|
||||
final int wallHeight = 1 + getSpellLevel(player);
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
Block block = starter;
|
||||
int currentRun;
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
|
||||
currentRun++;
|
||||
|
||||
BlockFace[] faces = UtilShapes.getCornerBlockFaces(block, facing);
|
||||
|
||||
if (block.getType() == Material.AIR)
|
||||
{
|
||||
block.setTypeIdAndData(Material.ICE.getId(), (byte) 0, false);
|
||||
_wallExpires.put(block, System.currentTimeMillis() + ((20 + UtilMath.r(10)) * 1000L));
|
||||
}
|
||||
|
||||
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
|
||||
|
||||
for (BlockFace face : faces)
|
||||
{
|
||||
for (int i = 1; i < wallWidth; i++)
|
||||
{
|
||||
|
||||
Block b = block.getRelative(face.getModX() * i, 0, face.getModZ() * i);
|
||||
|
||||
if (!UtilBlock.airFoliage(b))
|
||||
break;
|
||||
|
||||
b.setTypeIdAndData(Material.ICE.getId(), (byte) 0, false);
|
||||
b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, b.getTypeId());
|
||||
|
||||
_wallExpires.put(b, System.currentTimeMillis() + ((20 + UtilMath.r(10)) * 1000L));
|
||||
}
|
||||
}
|
||||
|
||||
block = block.getRelative(BlockFace.UP);
|
||||
if (currentRun >= wallHeight)
|
||||
{
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(Wizards.getArcadeManager().getPlugin(), 0, 5);
|
||||
|
||||
charge(player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockBreak(BlockBreakEvent event)
|
||||
{
|
||||
Block block = event.getBlock();
|
||||
|
||||
if (_wallExpires.containsKey(block))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
|
||||
block.setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockMelt(BlockFadeEvent event)
|
||||
{
|
||||
Block block = event.getBlock();
|
||||
|
||||
if (_wallExpires.containsKey(block))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
block.setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onUpdate(UpdateEvent event)
|
||||
{
|
||||
Iterator<Entry<Block, Long>> itel = _wallExpires.entrySet().iterator();
|
||||
|
||||
while (itel.hasNext())
|
||||
{
|
||||
Entry<Block, Long> entry = itel.next();
|
||||
|
||||
if (entry.getValue() < System.currentTimeMillis())
|
||||
{
|
||||
itel.remove();
|
||||
|
||||
if (entry.getKey().getType() == Material.ICE)
|
||||
{
|
||||
entry.getKey().setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class SpellGust extends Spell implements SpellClick
|
||||
{
|
||||
|
||||
@Override
|
||||
public void castSpell(final Player player)
|
||||
{
|
||||
final Vector vector = player.getLocation().getDirection().setY(0).normalize().multiply(1.5).setY(0.3)
|
||||
.multiply(1.2 + (getSpellLevel(player) * 0.4D));
|
||||
|
||||
final HashMap<Player, Double> effected = UtilPlayer.getPlayersInPyramid(player, 45, 10 * getSpellLevel(player));
|
||||
|
||||
if (!effected.isEmpty())
|
||||
{
|
||||
charge(player);
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(Wizards.getArcadeManager().getPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
for (Player target : effected.keySet())
|
||||
{
|
||||
if (!Wizards.IsAlive(target))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Wizards.getArcadeManager().GetCondition().Factory().Falling("Gust", target, player, 10, false, true);
|
||||
|
||||
target.setVelocity(vector);
|
||||
|
||||
target.getWorld().playSound(target.getLocation(), Sound.BAT_TAKEOFF, 1, 0.7F);
|
||||
}
|
||||
|
||||
player.playSound(player.getLocation(), Sound.BAT_TAKEOFF, 1, 0.7F);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -2,42 +2,27 @@ package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClickEntity;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class SpellHeal extends Spell implements SpellClick, SpellClickEntity
|
||||
public class SpellHeal extends Spell implements SpellClick
|
||||
{
|
||||
|
||||
@Override
|
||||
public void castSpell(Player p)
|
||||
{
|
||||
castSpell(p, p);
|
||||
}
|
||||
@Override
|
||||
public void castSpell(Player p)
|
||||
{
|
||||
if (p.getHealth() < p.getMaxHealth())
|
||||
{
|
||||
double health = p.getHealth() + (3 + getSpellLevel(p));
|
||||
|
||||
@Override
|
||||
public void castSpell(Player p, Entity target)
|
||||
{
|
||||
if (!(target instanceof LivingEntity))
|
||||
return;
|
||||
if (health > p.getMaxHealth())
|
||||
health = p.getMaxHealth();
|
||||
|
||||
LivingEntity entity = (LivingEntity) target;
|
||||
p.setHealth(health);
|
||||
|
||||
if (entity.getHealth() < entity.getMaxHealth())
|
||||
{
|
||||
double health = entity.getHealth() + (3 + getSpellLevel(p));
|
||||
p.getWorld().spigot().playEffect(p.getEyeLocation(), Effect.HEART, 0, 0, 0.8F, 0.4F, 0.8F, 0, 6, 30);
|
||||
|
||||
if (health > entity.getMaxHealth())
|
||||
health = entity.getMaxHealth();
|
||||
|
||||
entity.setHealth(health);
|
||||
|
||||
entity.getWorld().spigot().playEffect(entity.getEyeLocation(), Effect.HEART, 0, 0, 0.8F, 0.4F, 0.8F, 0, 6, 30);
|
||||
|
||||
charge(p);
|
||||
}
|
||||
}
|
||||
charge(p);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,70 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spells.subclasses.HealingRune;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
public class SpellHealingRune extends Spell implements SpellClick
|
||||
{
|
||||
private ArrayList<HealingRune> _healingRunes = new ArrayList<HealingRune>();
|
||||
|
||||
@EventHandler
|
||||
public void onTick(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() == UpdateType.TICK)
|
||||
{
|
||||
Iterator<HealingRune> itel = _healingRunes.iterator();
|
||||
|
||||
while (itel.hasNext())
|
||||
{
|
||||
HealingRune rune = itel.next();
|
||||
|
||||
if (rune.onTick())
|
||||
{
|
||||
itel.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void castSpell(Player player)
|
||||
{
|
||||
Block b = player.getTargetBlock(null, 25 * getSpellLevel(player));
|
||||
|
||||
while (b.getType() != Material.AIR && b.getY() < 250)
|
||||
{
|
||||
b = b.getRelative(BlockFace.UP);
|
||||
}
|
||||
|
||||
if (b.getRelative(BlockFace.DOWN).getType() == Material.AIR)
|
||||
{
|
||||
player.sendMessage(ChatColor.RED + "Unable to place a rune!");
|
||||
return;
|
||||
}
|
||||
|
||||
Location firstTeleport = player.getLocation();
|
||||
|
||||
firstTeleport.setY(firstTeleport.getBlockY());
|
||||
|
||||
HealingRune healingRune = new HealingRune(Wizards, firstTeleport, getSpellLevel(player));
|
||||
|
||||
_healingRunes.add(healingRune);
|
||||
|
||||
charge(player);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,149 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.projectile.IThrown;
|
||||
import mineplex.core.projectile.ProjectileUser;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockFadeEvent;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
public class SpellIcePrison extends Spell implements SpellClick, IThrown
|
||||
{
|
||||
|
||||
private HashMap<Block, Long> _prisonExpires = new HashMap<Block, Long>();
|
||||
|
||||
@EventHandler
|
||||
public void onBlockBreak(BlockBreakEvent event)
|
||||
{
|
||||
Block block = event.getBlock();
|
||||
|
||||
if (_prisonExpires.containsKey(block))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
|
||||
block.setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockMelt(BlockFadeEvent event)
|
||||
{
|
||||
Block block = event.getBlock();
|
||||
|
||||
if (_prisonExpires.containsKey(block))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
block.setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void castSpell(final Player player)
|
||||
{
|
||||
shoot(player, getSpellLevel(player));
|
||||
|
||||
charge(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Collide(LivingEntity target, Block block, ProjectileUser data)
|
||||
{
|
||||
if (target != data.GetThrower())
|
||||
{
|
||||
IcePrison(data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Expire(ProjectileUser data)
|
||||
{
|
||||
IcePrison(data);
|
||||
}
|
||||
|
||||
public void IcePrison(ProjectileUser data)
|
||||
{
|
||||
Location loc = data.GetThrown().getLocation();
|
||||
data.GetThrown().remove();
|
||||
|
||||
HashMap<Block, Double> blocks = UtilBlock.getInRadius(loc.getBlock(),
|
||||
data.GetThrown().getMetadata("PrisonStrength").get(0).asDouble(), true);
|
||||
|
||||
for (Block block : blocks.keySet())
|
||||
{
|
||||
if (_prisonExpires.containsKey(block) || UtilBlock.airFoliage(block))
|
||||
{
|
||||
block.setType(Material.ICE);
|
||||
|
||||
_prisonExpires.put(block, System.currentTimeMillis() + ((20 + UtilMath.r(10)) * 1000L));
|
||||
}
|
||||
}
|
||||
|
||||
// Effect
|
||||
loc.getWorld().playSound(loc, Sound.SILVERFISH_HIT, 2f, 1f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Idle(ProjectileUser data)
|
||||
{
|
||||
IcePrison(data);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onUpdate(UpdateEvent event)
|
||||
{
|
||||
Iterator<Entry<Block, Long>> itel = _prisonExpires.entrySet().iterator();
|
||||
|
||||
while (itel.hasNext())
|
||||
{
|
||||
Entry<Block, Long> entry = itel.next();
|
||||
|
||||
if (entry.getValue() < System.currentTimeMillis())
|
||||
{
|
||||
itel.remove();
|
||||
|
||||
if (entry.getKey().getType() == Material.ICE)
|
||||
{
|
||||
entry.getKey().setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void shoot(Player player, int spellLevel)
|
||||
{
|
||||
|
||||
if (Wizards.IsAlive(player))
|
||||
{
|
||||
org.bukkit.entity.Item ent = player.getWorld().dropItem(
|
||||
player.getEyeLocation(),
|
||||
ItemStackFactory.Instance.CreateStack(Material.PACKED_ICE, (byte) 0, 1, "Ice Prison" + player.getName() + " "
|
||||
+ System.currentTimeMillis()));
|
||||
|
||||
ent.setMetadata("PrisonStrength", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), 3 + spellLevel));
|
||||
|
||||
UtilAction.velocity(ent, player.getLocation().getDirection(), 1.7, false, 0, 0.2, 10, false);
|
||||
Wizards.getArcadeManager().GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 2f);
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.CREEPER_HISS, 1.2F, 0.8F);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,152 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilShapes;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.projectile.IThrown;
|
||||
import mineplex.core.projectile.ProjectileUser;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
public class SpellIceShards extends Spell implements SpellClick, IThrown
|
||||
{
|
||||
private HashMap<Entity, Location> _lastParticles = new HashMap<Entity, Location>();
|
||||
|
||||
@Override
|
||||
public void castSpell(final Player player)
|
||||
{
|
||||
shoot(player);
|
||||
|
||||
for (int i = 1; i <= getSpellLevel(player); i++)
|
||||
{
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(Wizards.getArcadeManager().getPlugin(), new Runnable()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
shoot(player);
|
||||
}
|
||||
|
||||
}, i * 5);
|
||||
}
|
||||
|
||||
charge(player);
|
||||
}
|
||||
|
||||
private void shoot(Player player)
|
||||
{
|
||||
|
||||
if (Wizards.IsAlive(player))
|
||||
{
|
||||
// Boost
|
||||
|
||||
org.bukkit.entity.Item ent = player.getWorld().dropItem(
|
||||
player.getEyeLocation(),
|
||||
ItemStackFactory.Instance.CreateStack(Material.GHAST_TEAR, (byte) 0, 1, "Ice Shard " + player.getName() + " "
|
||||
+ System.currentTimeMillis()));
|
||||
|
||||
UtilAction.velocity(ent, player.getLocation().getDirection(), 2, false, 0, 0.2, 10, false);
|
||||
Wizards.getArcadeManager().GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 2f);
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.CLICK, 1.2F, 0.8F);
|
||||
|
||||
_lastParticles.put(ent, ent.getLocation());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Collide(LivingEntity target, Block block, ProjectileUser data)
|
||||
{
|
||||
if (target != null && target instanceof Player)
|
||||
{
|
||||
|
||||
// Damage Event
|
||||
Wizards.getArcadeManager()
|
||||
.GetDamage()
|
||||
.NewDamageEvent(target, data.GetThrower(), null, DamageCause.PROJECTILE, 4 /*+ (timesHit * 2)*/, true, true,
|
||||
false, "Ice Shard", "Ice Shard");
|
||||
|
||||
}
|
||||
|
||||
handleShard(data);
|
||||
}
|
||||
|
||||
private void handleShard(ProjectileUser data)
|
||||
{
|
||||
data.GetThrown().remove();
|
||||
Location loc = data.GetThrown().getLocation();
|
||||
|
||||
UtilParticle.PlayParticle(ParticleType.BLOCK_CRACK.getParticle(Material.PACKED_ICE, 0), loc, 0.3F, 0.3F, 0.3F, 0, 12);
|
||||
loc.getWorld().playSound(loc, Sound.GLASS, 1.2F, 1);
|
||||
|
||||
for (int x = -1; x <= 1; x++)
|
||||
{
|
||||
for (int y = -1; y <= 1; y++)
|
||||
{
|
||||
for (int z = -1; z <= 1; z++)
|
||||
{
|
||||
Block block = loc.clone().add(x, y, z).getBlock();
|
||||
|
||||
if (block.getType() == Material.FIRE)
|
||||
{
|
||||
block.setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_lastParticles.remove(data.GetThrown());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onTick(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (Entity entity : _lastParticles.keySet())
|
||||
{
|
||||
for (Location loc : UtilShapes.getLinesDistancedPoints(_lastParticles.get(entity), entity.getLocation(), 0.3))
|
||||
{
|
||||
UtilParticle.PlayParticle(ParticleType.BLOCK_CRACK.getParticle(Material.PACKED_ICE, 0), loc, 0, 0, 0, 0, 1);
|
||||
}
|
||||
|
||||
_lastParticles.put(entity, entity.getLocation());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Idle(ProjectileUser data)
|
||||
{
|
||||
handleShard(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Expire(ProjectileUser data)
|
||||
{
|
||||
handleShard(data);
|
||||
}
|
||||
|
||||
}
|
@ -1,8 +1,15 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
|
||||
@ -12,74 +19,143 @@ import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class SpellImplode extends Spell implements SpellClick
|
||||
{
|
||||
|
||||
@Override
|
||||
public void castSpell(Player p)
|
||||
{
|
||||
List<Block> list = p.getLastTwoTargetBlocks(UtilBlock.blockAirFoliageSet, 50);
|
||||
@Override
|
||||
public void castSpell(final Player p)
|
||||
{
|
||||
List<Block> list = p.getLastTwoTargetBlocks(UtilBlock.blockAirFoliageSet, 50);
|
||||
|
||||
if (list.size() > 1)
|
||||
{
|
||||
BlockFace face = list.get(0).getFace(list.get(1));
|
||||
if (list.size() > 1)
|
||||
{
|
||||
|
||||
Block centerBlock = list.get(0);
|
||||
Block centerBlock = list.get(0);
|
||||
|
||||
int maxDist = (int) Math.floor(centerBlock.getLocation().distance(p.getLocation().getBlock().getLocation())) / 2;
|
||||
final Location centerLocation = centerBlock.getLocation().clone().add(0.5, 0.5, 0.5);
|
||||
final ArrayList<Block> effectedBlocks = new ArrayList<Block>();
|
||||
int size = (int) (1.5F + (getSpellLevel(p) * 0.7F));
|
||||
|
||||
for (int i = 0; i < Math.min(maxDist, getSpellLevel(p) * 2); i++)
|
||||
{
|
||||
if (centerBlock.getRelative(face) != null)
|
||||
{
|
||||
centerBlock = centerBlock.getRelative(face);
|
||||
}
|
||||
}
|
||||
for (int x = -size * 2; x <= size * 2; x++)
|
||||
{
|
||||
for (int y = -size * 2; y <= size * 2; y++)
|
||||
{
|
||||
for (int z = -size * 2; z <= size * 2; z++)
|
||||
{
|
||||
Block effectedBlock = centerBlock.getRelative(x, y, z);
|
||||
|
||||
Location centerLocation = centerBlock.getLocation().clone().add(0.5, 0.5, 0.5);
|
||||
int size = (int) (1.5F + (getSpellLevel(p) * 0.7F));
|
||||
if (effectedBlock.getType() == Material.AIR || effectedBlock.getType() == Material.BEDROCK
|
||||
|| effectedBlocks.contains(effectedBlock))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (int x = -size * 2; x <= size * 2; x++)
|
||||
{
|
||||
for (int y = -size; y <= size; y++)
|
||||
{
|
||||
for (int z = -size * 2; z <= size * 2; z++)
|
||||
{
|
||||
Block effectedBlock = centerBlock.getRelative(x, y, z);
|
||||
if ((centerLocation.distance(effectedBlock.getLocation().add(0.5, 0.5, 0.5)) + Math.abs(y / 4D))
|
||||
|
||||
if (effectedBlock.getLocation().distance(centerBlock.getLocation()) <= size * 2
|
||||
&& !(effectedBlock.getState() instanceof InventoryHolder))
|
||||
{
|
||||
<= ((size * 2) + UtilMath.random.nextFloat())
|
||||
|
||||
if (effectedBlock.getType() == Material.BEDROCK)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
&& !(effectedBlock.getState() instanceof InventoryHolder))
|
||||
{
|
||||
|
||||
FallingBlock block = effectedBlock.getWorld().spawnFallingBlock(effectedBlock.getLocation(),
|
||||
effectedBlock.getType(), effectedBlock.getData());
|
||||
effectedBlocks.add(effectedBlock);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
block.setVelocity(centerLocation.toVector()
|
||||
.subtract(effectedBlock.getLocation().add(0.5, 0.5, 0.5).toVector()).normalize());
|
||||
Collections.shuffle(effectedBlocks);
|
||||
|
||||
block.setDropItem(false);
|
||||
new BukkitRunnable()
|
||||
{
|
||||
int timesRan;
|
||||
Iterator<Block> bItel;
|
||||
|
||||
effectedBlock.setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void run()
|
||||
{
|
||||
{
|
||||
Block block = effectedBlocks.get(UtilMath.r(effectedBlocks.size()));
|
||||
block.getWorld().playSound(block.getLocation(),
|
||||
new Random().nextBoolean() ? Sound.DIG_GRAVEL : Sound.DIG_GRASS, 2,
|
||||
UtilMath.random.nextFloat() / 4);
|
||||
}
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
player.playSound(player == p ? p.getLocation() : centerBlock.getLocation(), Sound.ENDERDRAGON_GROWL, 1.5F, 1.5F);
|
||||
}
|
||||
if (timesRan % 3 == 0)
|
||||
{
|
||||
for (int a = 0; a < Math.ceil(effectedBlocks.size() / 3D); a++)
|
||||
{
|
||||
if (bItel == null || !bItel.hasNext())
|
||||
{
|
||||
bItel = effectedBlocks.iterator();
|
||||
}
|
||||
|
||||
charge(p);
|
||||
}
|
||||
}
|
||||
Block block = bItel.next();
|
||||
|
||||
if (block.getType() == Material.AIR)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
BlockFace face = BlockFace.values()[i];
|
||||
|
||||
Block b = block.getRelative(face);
|
||||
|
||||
if (UtilBlock.airFoliage(b))
|
||||
{
|
||||
UtilParticle.PlayParticle(
|
||||
ParticleType.BLOCK_CRACK.getParticle(block.getType(), block.getData()),
|
||||
|
||||
block.getLocation().add(
|
||||
|
||||
0.5 + (face.getModX() * 0.6D),
|
||||
|
||||
0.5 + (face.getModY() * 0.6D),
|
||||
|
||||
0.5 + (face.getModZ() * 0.6D)),
|
||||
|
||||
face.getModX() / 2F, face.getModX() / 2F, face.getModX() / 2F, 0, 6);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (effectedBlocks.isEmpty())
|
||||
{
|
||||
cancel();
|
||||
}
|
||||
else if (timesRan++ >= 20)
|
||||
{
|
||||
Iterator<Block> itel = effectedBlocks.iterator();
|
||||
|
||||
while (itel.hasNext())
|
||||
{
|
||||
Block block = itel.next();
|
||||
|
||||
if (block.getType() == Material.AIR || block.getState() instanceof InventoryHolder)
|
||||
{
|
||||
itel.remove();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
Wizards.getArcadeManager().GetExplosion().BlockExplosion(effectedBlocks, centerLocation, false);
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
player.playSound(player == p ? p.getLocation() : centerLocation, Sound.ENDERDRAGON_GROWL, 1.5F, 1.5F);
|
||||
}
|
||||
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(Wizards.getArcadeManager().getPlugin(), 0, 0);
|
||||
|
||||
charge(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,101 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilShapes;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.explosion.CustomExplosion;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
public class SpellLance extends Spell implements SpellClick
|
||||
{
|
||||
private ArrayList<Entry<ArrayList<Location>, Player>> _locations = new ArrayList<Entry<ArrayList<Location>, Player>>();
|
||||
|
||||
@Override
|
||||
public void castSpell(Player player)
|
||||
{
|
||||
// Player p = UtilPlayer.getPlayerInSight(player, 10 * getSpellLevel(player), true);
|
||||
Location l = null;
|
||||
// if (p == null)
|
||||
// {
|
||||
List<Block> b = player.getLastTwoTargetBlocks(UtilBlock.blockPassSet, 6 * getSpellLevel(player));
|
||||
if (!b.isEmpty())
|
||||
l = b.get(0).getLocation().add(0.5, 0.5, 0.5).add(player.getEyeLocation().getDirection().normalize().multiply(2));
|
||||
/* }
|
||||
else
|
||||
{
|
||||
l = p.getEyeLocation();
|
||||
}*/
|
||||
if (l != null)
|
||||
{
|
||||
ArrayList<Location> locs = UtilShapes.getLinesDistancedPoints(player.getLocation(), l, 1.5);
|
||||
|
||||
Iterator<Location> itel = locs.iterator();
|
||||
while (itel.hasNext())
|
||||
{
|
||||
Location loc = itel.next();
|
||||
|
||||
if (loc.distance(player.getLocation()) <= 1.5)
|
||||
{
|
||||
itel.remove();
|
||||
}
|
||||
}
|
||||
|
||||
if (!locs.isEmpty())
|
||||
{
|
||||
charge(player);
|
||||
|
||||
explode(locs.remove(0), player);
|
||||
|
||||
if (!locs.isEmpty())
|
||||
{
|
||||
_locations.add(new HashMap.SimpleEntry(locs, player));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onTick(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() == UpdateType.TICK)
|
||||
{
|
||||
Iterator<Entry<ArrayList<Location>, Player>> itel = _locations.iterator();
|
||||
while (itel.hasNext())
|
||||
{
|
||||
Entry<ArrayList<Location>, Player> next = itel.next();
|
||||
explode(next.getKey().remove(0), next.getValue());
|
||||
|
||||
if (next.getKey().isEmpty())
|
||||
{
|
||||
itel.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void explode(Location loc, Player player)
|
||||
{
|
||||
CustomExplosion explosion = new CustomExplosion(Wizards.getArcadeManager().GetDamage(), loc, 1.2F, "Lance");
|
||||
|
||||
explosion.setPlayer(player, false);
|
||||
|
||||
explosion.setDropItems(false);
|
||||
|
||||
explosion.setIgnoreRate(false);
|
||||
|
||||
explosion.explode();
|
||||
}
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClickEntity;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class SpellLaunch extends Spell implements SpellClickEntity
|
||||
{
|
||||
|
||||
@Override
|
||||
public void castSpell(Player player, final Entity entity)
|
||||
{
|
||||
if (entity instanceof LivingEntity)
|
||||
{
|
||||
|
||||
Wizards.getArcadeManager().GetCondition().Factory()
|
||||
.Falling("Launch", (LivingEntity) entity, player, 10, false, false);
|
||||
|
||||
final int spellLevel = getSpellLevel(player);
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(Wizards.getArcadeManager().getPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
((LivingEntity) entity).setVelocity(new Vector(0, 1F + (spellLevel * 0.15F), 0));
|
||||
entity.getWorld().playSound(((LivingEntity) entity).getLocation(), Sound.BAT_TAKEOFF, 2, 0);
|
||||
entity.setFallDistance(-spellLevel * 1.5F);
|
||||
}
|
||||
});
|
||||
|
||||
charge(player);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,100 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spells.subclasses.LaunchRune;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class SpellLaunchRune extends Spell implements SpellClick
|
||||
{
|
||||
private ArrayList<LaunchRune> _launchRunes = new ArrayList<LaunchRune>();
|
||||
|
||||
@Override
|
||||
public void castSpell(Player p)
|
||||
{
|
||||
Vector vector = p.getEyeLocation().getDirection();
|
||||
vector.normalize().multiply(0.5);
|
||||
|
||||
Vector v = p.getEyeLocation().toVector();
|
||||
int i = 0;
|
||||
Location loc = null;
|
||||
int spellLevel = getSpellLevel(p);
|
||||
final float trapSize = Math.max(1, spellLevel * 0.8F);
|
||||
|
||||
while (i++ < (trapSize * 4) + 12)
|
||||
{
|
||||
v.add(vector);
|
||||
|
||||
Block b = v.toLocation(p.getWorld()).getBlock();
|
||||
|
||||
if (UtilBlock.solid(b))
|
||||
{
|
||||
while (UtilBlock.solid(b))
|
||||
{
|
||||
|
||||
double dist = Math.sqrt(Math.pow(v.getX() - v.getBlockX(), 2) + Math.pow(v.getY() - v.getBlockY(), 2)
|
||||
+ Math.pow(v.getZ() - v.getBlockZ(), 2)) + 0.01;
|
||||
b = v.subtract(vector.normalize().multiply(dist)).toLocation(p.getWorld()).getBlock();
|
||||
}
|
||||
|
||||
loc = v.toLocation(p.getWorld());
|
||||
loc.setY(loc.getBlockY());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (loc == null)
|
||||
return;
|
||||
|
||||
LaunchRune rune = new LaunchRune(Wizards, p, loc, trapSize, spellLevel);
|
||||
|
||||
if (!isValid(rune))
|
||||
{
|
||||
p.sendMessage(C.cGreen + "Cannot draw rune on wall");
|
||||
return;
|
||||
}
|
||||
|
||||
_launchRunes.add(rune);
|
||||
charge(p);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onTick(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() == UpdateType.TICK)
|
||||
{
|
||||
Iterator<LaunchRune> itel = _launchRunes.iterator();
|
||||
|
||||
while (itel.hasNext())
|
||||
{
|
||||
|
||||
LaunchRune rune = itel.next();
|
||||
|
||||
if (rune.onTick())
|
||||
{
|
||||
itel.remove();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isValid(LaunchRune rune)
|
||||
{
|
||||
return !UtilBlock.solid(rune.getLocation().getBlock())
|
||||
|| UtilBlock.solid(rune.getLocation().getBlock().getRelative(BlockFace.DOWN));
|
||||
}
|
||||
}
|
@ -1,12 +1,17 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.LightningStrike;
|
||||
@ -16,53 +21,131 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class SpellLightningStrike extends Spell implements SpellClick
|
||||
{
|
||||
|
||||
@Override
|
||||
public void castSpell(Player p)
|
||||
{
|
||||
List<Block> list = p.getLastTwoTargetBlocks(UtilBlock.blockAirFoliageSet, 150);
|
||||
if (list.size() > 1)
|
||||
{
|
||||
Location loc = list.get(0).getLocation();
|
||||
@Override
|
||||
public void castSpell(final Player p)
|
||||
{
|
||||
double curRange = 0;
|
||||
|
||||
while (UtilBlock.solid(loc.getBlock().getRelative(BlockFace.UP)))
|
||||
{
|
||||
loc.add(0, 1, 0);
|
||||
}
|
||||
while (curRange <= 150)
|
||||
{
|
||||
Location newTarget = p.getEyeLocation().add(new Vector(0, 0.2, 0))
|
||||
.add(p.getLocation().getDirection().multiply(curRange));
|
||||
|
||||
LightningStrike lightning = p.getWorld().strikeLightning(loc);
|
||||
if (!UtilBlock.airFoliage(newTarget.getBlock())
|
||||
|| !UtilBlock.airFoliage(newTarget.getBlock().getRelative(BlockFace.UP)))
|
||||
break;
|
||||
|
||||
lightning.setMetadata("Damager", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), p));
|
||||
// Progress Forwards
|
||||
curRange += 0.2;
|
||||
}
|
||||
|
||||
charge(p);
|
||||
}
|
||||
}
|
||||
if (curRange < 2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntityDamage(EntityDamageByEntityEvent event)
|
||||
{
|
||||
if (event.getDamager() instanceof LightningStrike && event.getEntity() instanceof LivingEntity)
|
||||
{
|
||||
LightningStrike lightning = (LightningStrike) event.getDamager();
|
||||
if (lightning.hasMetadata("Damager"))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
// Destination
|
||||
final Location loc = p.getLocation().add(p.getLocation().getDirection().multiply(curRange).add(new Vector(0, 0.4, 0)));
|
||||
|
||||
if (!lightning.hasMetadata("IgnoreDamage"))
|
||||
{
|
||||
lightning.setMetadata("IgnoreDamage", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), null));
|
||||
while (UtilBlock.solid(loc.getBlock().getRelative(BlockFace.UP)))
|
||||
{
|
||||
loc.add(0, 1, 0);
|
||||
}
|
||||
|
||||
Wizards.getArcadeManager()
|
||||
.GetDamage()
|
||||
.NewDamageEvent((LivingEntity) event.getEntity(),
|
||||
(Player) lightning.getMetadata("Damager").get(0).value(), null, DamageCause.LIGHTNING,
|
||||
event.getDamage(), false, true, false, "Lightning Strike", "Lightning Strike");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
UtilParticle.PlayParticle(ParticleType.ANGRY_VILLAGER, loc.clone().add(0, 1.3, 0), 0.5F, 0.3F, 0.5F, 0, 7);
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(Wizards.getArcadeManager().getPlugin(), new Runnable()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
LightningStrike lightning = p.getWorld().strikeLightning(loc);
|
||||
|
||||
lightning.setMetadata("Damager", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), p));
|
||||
|
||||
Block b = loc.getWorld().getHighestBlockAt(loc);
|
||||
|
||||
b = b.getRelative(BlockFace.DOWN);
|
||||
|
||||
ArrayList<Block> toExplode = new ArrayList<Block>();
|
||||
ArrayList<Block> toFire = new ArrayList<Block>();
|
||||
|
||||
for (int x = -1; x <= 1; x++)
|
||||
{
|
||||
for (int y = -1; y <= 1; y++)
|
||||
{
|
||||
for (int z = -1; z <= 1; z++)
|
||||
{
|
||||
if (x == 0 || (Math.abs(x) != Math.abs(z) || UtilMath.r(3) == 0))
|
||||
{
|
||||
Block block = b.getRelative(x, y, z);
|
||||
|
||||
if ((y == 0 || (x == 0 && z == 0)) && block.getType() != Material.AIR
|
||||
&& block.getType() != Material.BEDROCK)
|
||||
{
|
||||
if (y == 0 || UtilMath.random.nextBoolean())
|
||||
{
|
||||
toExplode.add(block);
|
||||
toFire.add(block);
|
||||
}
|
||||
}
|
||||
else if (block.getType() == Material.AIR)
|
||||
{
|
||||
toFire.add(block);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Wizards.getArcadeManager().GetExplosion().BlockExplosion(toExplode, b.getLocation(), false);
|
||||
|
||||
for (Block block : toFire)
|
||||
{
|
||||
if (UtilMath.random.nextBoolean())
|
||||
{
|
||||
block.setType(Material.FIRE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}, 20);
|
||||
|
||||
charge(p);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntityDamage(EntityDamageByEntityEvent event)
|
||||
{
|
||||
if (event.getDamager() instanceof LightningStrike && event.getEntity() instanceof LivingEntity)
|
||||
{
|
||||
LightningStrike lightning = (LightningStrike) event.getDamager();
|
||||
|
||||
if (lightning.hasMetadata("Damager"))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
|
||||
if (!lightning.hasMetadata("IgnoreDamage"))
|
||||
{
|
||||
lightning.setMetadata("IgnoreDamage", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), null));
|
||||
|
||||
event.getEntity().setFireTicks(80);
|
||||
|
||||
Player player = (Player) lightning.getMetadata("Damager").get(0).value();
|
||||
|
||||
Wizards.getArcadeManager()
|
||||
.GetDamage()
|
||||
.NewDamageEvent((LivingEntity) event.getEntity(), player, null, DamageCause.LIGHTNING,
|
||||
4 + (4 * getSpellLevel(player)), false, true, false, "Lightning Strike", "Lightning Strike");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,166 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class SpellMagicMissile extends Spell implements SpellClick
|
||||
{
|
||||
|
||||
public void castSpell(final Player player)
|
||||
{
|
||||
final Location missileLocation = player.getEyeLocation();
|
||||
final Location shotFrom = missileLocation.clone();
|
||||
final Vector direction = missileLocation.getDirection().normalize().multiply(0.3);
|
||||
final int maxRange = 15 * getSpellLevel(player);
|
||||
final int maxDings = maxRange * 3;
|
||||
final int damage = 4 + getSpellLevel(player);
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
private int dingsDone;
|
||||
|
||||
private void burst()
|
||||
{
|
||||
for (Entity cur : missileLocation.getWorld().getEntities())
|
||||
{
|
||||
|
||||
if (cur == player || !(cur instanceof LivingEntity)
|
||||
|| (cur instanceof Player && UtilPlayer.isSpectator(cur)))
|
||||
continue;
|
||||
|
||||
LivingEntity entity = (LivingEntity) cur;
|
||||
|
||||
Location eLoc = entity.getLocation();
|
||||
|
||||
// If they are less than 0.5 blocks away
|
||||
if (eLoc.clone().add(0, missileLocation.getY() - eLoc.getY(), 0).distance(missileLocation) <= 0.7)
|
||||
{
|
||||
// If it is in their body height
|
||||
if (Math.abs((eLoc.getY() + (entity.getEyeHeight() / 1.5)) - missileLocation.getY()) <= entity
|
||||
.getEyeHeight() / 2)
|
||||
{
|
||||
|
||||
if (entity != player && (!(entity instanceof Player) || Wizards.IsAlive(entity)))
|
||||
{
|
||||
Wizards.Manager.GetDamage().NewDamageEvent(entity, player, null, DamageCause.CUSTOM, damage,
|
||||
true, true, false, "Magic Missile", "Magic Missile");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UtilParticle.PlayParticle(ParticleType.MAGIC_CRIT, missileLocation, 0.5F, 0.5F, 0.5F, 0, 40);
|
||||
missileLocation.getWorld().playSound(missileLocation, Sound.BAT_TAKEOFF, 1.2F, 1);
|
||||
cancel();
|
||||
}
|
||||
|
||||
public void run()
|
||||
{
|
||||
if (dingsDone >= maxDings || !player.isOnline() || !Wizards.Manager.IsAlive(player))
|
||||
{
|
||||
burst();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
Player closestPlayer = null;
|
||||
double dist = 0;
|
||||
|
||||
// This lot of code makes the magic missile change direction towards the closest player in its path
|
||||
// Not entirely accurate, it doesn't go only for the people it can hit.
|
||||
// This makes magic missile pretty cool in my opinion
|
||||
for (Player closest : Wizards.GetPlayers(true))
|
||||
{
|
||||
|
||||
Location loc = closest.getLocation();
|
||||
|
||||
if (closest != player)
|
||||
{
|
||||
double dist1 = loc.distance(shotFrom);
|
||||
// If the player is a valid target
|
||||
if (dist1 < maxRange + 10)
|
||||
{
|
||||
double dist2 = missileLocation.distance(loc);
|
||||
// If the player is closer to the magic missile than the other dist
|
||||
if (closestPlayer == null || dist2 < dist)
|
||||
{
|
||||
double dist3 = missileLocation.clone().add(direction).distance(loc);
|
||||
|
||||
if (dist3 < dist2)
|
||||
{
|
||||
// If the magic missile grows closer when it moves
|
||||
closestPlayer = closest;
|
||||
dist = dist2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (closestPlayer != null)
|
||||
{
|
||||
Vector newDirection = closestPlayer.getLocation().add(0, 1, 0).toVector()
|
||||
.subtract(missileLocation.toVector());
|
||||
|
||||
direction.add(newDirection.normalize().multiply(0.01)).normalize().multiply(0.3);
|
||||
}
|
||||
|
||||
missileLocation.add(direction);
|
||||
|
||||
for (Entity cur : missileLocation.getWorld().getEntities())
|
||||
{
|
||||
|
||||
if (cur == player || !(cur instanceof LivingEntity)
|
||||
|| (cur instanceof Player && UtilPlayer.isSpectator(cur)))
|
||||
continue;
|
||||
|
||||
LivingEntity ent = (LivingEntity) cur;
|
||||
|
||||
Location eLoc = ent.getLocation();
|
||||
|
||||
// If they are less than 0.5 blocks away
|
||||
if (eLoc.clone().add(0, missileLocation.getY() - eLoc.getY(), 0).distance(missileLocation) <= 0.7)
|
||||
{
|
||||
// If it is in their body height
|
||||
if (Math.abs((eLoc.getY() + (ent.getEyeHeight() / 1.5)) - missileLocation.getY()) <= ent
|
||||
.getEyeHeight() / 2)
|
||||
{
|
||||
burst();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (UtilBlock.solid(missileLocation.getBlock()))
|
||||
{
|
||||
burst();
|
||||
return;
|
||||
}
|
||||
|
||||
dingsDone++;
|
||||
}
|
||||
|
||||
UtilParticle.PlayParticle(ParticleType.MAGIC_CRIT, missileLocation, 0, 0, 0, 0, 1);
|
||||
missileLocation.getWorld().playSound(missileLocation, Sound.ORB_PICKUP, 0.7F, 0);
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(Wizards.Manager.getPlugin(), 0, 0);
|
||||
|
||||
charge(player);
|
||||
}
|
||||
}
|
@ -0,0 +1,213 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilShapes;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class SpellManaBolt extends Spell implements SpellClick
|
||||
{
|
||||
|
||||
public void castSpell(final Player player)
|
||||
{
|
||||
final Location missileLocation = player.getEyeLocation();
|
||||
final Location shotFrom = missileLocation.clone();
|
||||
final Vector direction = missileLocation.getDirection().normalize().multiply(0.3);
|
||||
final int maxRange = 20 + (10 * getSpellLevel(player));
|
||||
final int maxDings = maxRange * 3;
|
||||
final int damage = 4 + (getSpellLevel(player) * 2);
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
private int dingsDone;
|
||||
private Location previousLocation = missileLocation;
|
||||
|
||||
private void burst()
|
||||
{
|
||||
for (Entity cur : missileLocation.getWorld().getEntities())
|
||||
{
|
||||
|
||||
if (cur == player || !(cur instanceof LivingEntity) || (cur instanceof Player && UtilPlayer.isSpectator(cur)))
|
||||
continue;
|
||||
|
||||
LivingEntity entity = (LivingEntity) cur;
|
||||
|
||||
Location eLoc = entity.getLocation();
|
||||
|
||||
// If they are less than 0.5 blocks away
|
||||
if (eLoc.clone().add(0, missileLocation.getY() - eLoc.getY(), 0).distance(missileLocation) <= 0.7)
|
||||
{
|
||||
// If it is in their body height
|
||||
if (Math.abs((eLoc.getY() + (entity.getEyeHeight() / 1.5)) - missileLocation.getY()) <= entity
|
||||
.getEyeHeight() / 2)
|
||||
{
|
||||
|
||||
if (entity != player && (!(entity instanceof Player) || Wizards.IsAlive(entity)))
|
||||
{
|
||||
Wizards.Manager.GetDamage().NewDamageEvent(entity, player, null, DamageCause.MAGIC, damage, true,
|
||||
true, false, "Mana Bolt", "Mana Bolt");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
playParticle(missileLocation, previousLocation);
|
||||
|
||||
for (int i = 0; i < 120; i++)
|
||||
{
|
||||
Vector vector = new Vector(new Random().nextFloat() - 0.5F, new Random().nextFloat() - 0.5F,
|
||||
new Random().nextFloat() - 0.5F);
|
||||
|
||||
if (vector.length() >= 1)
|
||||
{
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
|
||||
Location loc = missileLocation.clone();
|
||||
|
||||
loc.add(vector.multiply(2));
|
||||
|
||||
UtilParticle.PlayParticle(ParticleType.RED_DUST, loc, -1, 1, 1, 1, 0);
|
||||
}
|
||||
|
||||
missileLocation.getWorld().playSound(missileLocation, Sound.BAT_TAKEOFF, 1.2F, 1);
|
||||
cancel();
|
||||
}
|
||||
|
||||
public void run()
|
||||
{
|
||||
if (dingsDone >= maxDings || !player.isOnline() || !Wizards.Manager.IsAlive(player))
|
||||
{
|
||||
burst();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
Player closestPlayer = null;
|
||||
double dist = 0;
|
||||
|
||||
// This lot of code makes the magic missile change direction towards the closest player in its path
|
||||
// Not entirely accurate, it doesn't go only for the people it can hit.
|
||||
// This makes magic missile pretty cool in my opinion
|
||||
for (Player closest : Wizards.GetPlayers(true))
|
||||
{
|
||||
|
||||
Location loc = closest.getLocation();
|
||||
|
||||
if (closest != player)
|
||||
{
|
||||
double dist1 = loc.distance(shotFrom);
|
||||
// If the player is a valid target
|
||||
if (dist1 < maxRange + 10)
|
||||
{
|
||||
double dist2 = missileLocation.distance(loc);
|
||||
// If the player is closer to the magic missile than the other dist
|
||||
if (closestPlayer == null || dist2 < dist)
|
||||
{
|
||||
double dist3 = missileLocation.clone().add(direction).distance(loc);
|
||||
|
||||
if (dist3 < dist2)
|
||||
{
|
||||
// If the magic missile grows closer when it moves
|
||||
closestPlayer = closest;
|
||||
dist = dist2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (closestPlayer != null)
|
||||
{
|
||||
Vector newDirection = closestPlayer.getLocation().add(0, 1, 0).toVector()
|
||||
.subtract(missileLocation.toVector());
|
||||
|
||||
direction.add(newDirection.normalize().multiply(0.01)).normalize().multiply(0.3);
|
||||
}
|
||||
|
||||
missileLocation.add(direction);
|
||||
|
||||
for (Entity cur : missileLocation.getWorld().getEntities())
|
||||
{
|
||||
|
||||
if (cur == player || !(cur instanceof LivingEntity)
|
||||
|| (cur instanceof Player && UtilPlayer.isSpectator(cur)))
|
||||
continue;
|
||||
|
||||
LivingEntity ent = (LivingEntity) cur;
|
||||
|
||||
Location eLoc = ent.getLocation();
|
||||
|
||||
// If they are less than 0.5 blocks away
|
||||
if (eLoc.clone().add(0, missileLocation.getY() - eLoc.getY(), 0).distance(missileLocation) <= 0.7)
|
||||
{
|
||||
// If it is in their body height
|
||||
if (Math.abs((eLoc.getY() + (ent.getEyeHeight() / 1.5)) - missileLocation.getY()) <= ent
|
||||
.getEyeHeight() / 2)
|
||||
{
|
||||
burst();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (UtilBlock.solid(missileLocation.getBlock()))
|
||||
{
|
||||
burst();
|
||||
return;
|
||||
}
|
||||
|
||||
playParticle(missileLocation, previousLocation);
|
||||
previousLocation = missileLocation.clone();
|
||||
|
||||
dingsDone++;
|
||||
}
|
||||
|
||||
missileLocation.getWorld().playSound(missileLocation, Sound.ORB_PICKUP, 0.7F, 0);
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(Wizards.Manager.getPlugin(), 0, 0);
|
||||
|
||||
charge(player);
|
||||
}
|
||||
|
||||
private void playParticle(Location start, Location end)
|
||||
{
|
||||
final ArrayList<Location> locations = UtilShapes.getLinesDistancedPoints(start, end, 0.1);
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
int timesRan;
|
||||
|
||||
public void run()
|
||||
{
|
||||
for (Location loc : locations)
|
||||
{
|
||||
UtilParticle.PlayParticle(ParticleType.RED_DUST, loc, -1, 1, 1, 1, 0);
|
||||
}
|
||||
|
||||
if (timesRan++ > 1)
|
||||
{
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(Wizards.getArcadeManager().getPlugin(), 0, 0);
|
||||
}
|
||||
}
|
@ -0,0 +1,268 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Random;
|
||||
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class SpellNapalm extends Spell implements SpellClick
|
||||
{
|
||||
private HashMap<Material, Material> _glazedBlocks = new HashMap<Material, Material>();
|
||||
|
||||
public SpellNapalm()
|
||||
{
|
||||
_glazedBlocks.put(Material.STONE, Material.COBBLESTONE);
|
||||
_glazedBlocks.put(Material.GRASS, Material.DIRT);
|
||||
_glazedBlocks.put(Material.FENCE, Material.NETHER_FENCE);
|
||||
_glazedBlocks.put(Material.WOOD_STAIRS, Material.NETHER_BRICK_STAIRS);
|
||||
_glazedBlocks.put(Material.SMOOTH_STAIRS, Material.NETHER_BRICK_STAIRS);
|
||||
_glazedBlocks.put(Material.SAND, Material.GLASS);
|
||||
_glazedBlocks.put(Material.SMOOTH_BRICK, Material.NETHER_BRICK);
|
||||
_glazedBlocks.put(Material.LOG, Material.NETHERRACK);
|
||||
_glazedBlocks.put(Material.LOG_2, Material.NETHERRACK);
|
||||
_glazedBlocks.put(Material.SMOOTH_BRICK, Material.COBBLESTONE);
|
||||
_glazedBlocks.put(Material.CLAY, Material.STAINED_CLAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void castSpell(final Player player)
|
||||
{
|
||||
final int length = 5 + (10 * getSpellLevel(player));
|
||||
|
||||
final Vector vector = player.getLocation().getDirection().normalize().multiply(0.15);
|
||||
|
||||
final Location playerLoc = player.getLocation().add(0, 2, 0);
|
||||
final Location napalmLoc = playerLoc.clone().add(playerLoc.getDirection().normalize().multiply(2));
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
|
||||
ArrayList<Block> litOnFire = new ArrayList<Block>();
|
||||
HashMap<Block, Double> tempIgnore = new HashMap<Block, Double>();
|
||||
double blocksTravelled;
|
||||
double size = 1;
|
||||
double lastTick;
|
||||
|
||||
public void run()
|
||||
{
|
||||
Random r = new Random();
|
||||
napalmLoc.add(vector);
|
||||
|
||||
if (!UtilBlock.airFoliage(napalmLoc.getBlock()))
|
||||
{
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
for (int b = 0; b < size * 20; b++)
|
||||
{
|
||||
|
||||
float x = r.nextFloat();
|
||||
float y = r.nextFloat();
|
||||
float z = r.nextFloat();
|
||||
|
||||
while (Math.sqrt((x * x) + (y * y) + (z * z)) >= 1)
|
||||
{
|
||||
x = r.nextFloat();
|
||||
y = r.nextFloat();
|
||||
z = r.nextFloat();
|
||||
}
|
||||
|
||||
UtilParticle.PlayParticle(ParticleType.RED_DUST,
|
||||
|
||||
napalmLoc.clone().add(
|
||||
|
||||
(size * (x - 0.5)) / 5,
|
||||
|
||||
(size * (y - 0.5)) / 5,
|
||||
|
||||
(size * (z - 0.5)) / 5),
|
||||
|
||||
-0.3F,
|
||||
|
||||
0.35F + (r.nextFloat() / 8),
|
||||
|
||||
0.1F, 1, 0);
|
||||
}
|
||||
|
||||
if (lastTick % 3 == 0)
|
||||
{
|
||||
for (Entity entity : napalmLoc.getWorld().getEntities())
|
||||
{
|
||||
if (!UtilPlayer.isSpectator(entity))
|
||||
{
|
||||
double heat = (size * 1.1) - entity.getLocation().distance(napalmLoc);
|
||||
|
||||
if (heat > 0)
|
||||
{
|
||||
if (lastTick % 10 == 0 && heat > 0.2)
|
||||
{
|
||||
if (entity instanceof LivingEntity)
|
||||
{
|
||||
Wizards.getArcadeManager()
|
||||
.GetDamage()
|
||||
.NewDamageEvent((LivingEntity) entity, player, null, DamageCause.FIRE,
|
||||
heat / 1.5, false, true, true, "Napalm", "Napalm");
|
||||
}
|
||||
else
|
||||
{
|
||||
entity.remove();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (entity instanceof LivingEntity && !UtilPlayer.isSpectator(entity)
|
||||
&& entity.getFireTicks() < heat * 40)
|
||||
{
|
||||
entity.setFireTicks((int) (heat * 40));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int bSize = (int) Math.ceil(size * 0.75);
|
||||
|
||||
for (int y = -bSize; y <= bSize; y++)
|
||||
{
|
||||
if (napalmLoc.getBlockY() + y < 256 && napalmLoc.getBlockY() + y > 0)
|
||||
{
|
||||
for (int x = -bSize; x <= bSize; x++)
|
||||
{
|
||||
for (int z = -bSize; z <= bSize; z++)
|
||||
{
|
||||
Block block = napalmLoc.clone().add(x, y, z).getBlock();
|
||||
|
||||
if (litOnFire.contains(block))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (UtilMath.offset(block.getLocation().add(0.5, 0.5, 0.5), playerLoc) < 2.5)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
double heat = bSize - UtilMath.offset(block.getLocation().add(0.5, 0.5, 0.5), napalmLoc);
|
||||
|
||||
if (tempIgnore.containsKey(block))
|
||||
{
|
||||
if (tempIgnore.remove(block) > heat)
|
||||
{
|
||||
litOnFire.add(block);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (heat > 0)
|
||||
{
|
||||
if (block.getType() != Material.AIR)
|
||||
{
|
||||
float strength = net.minecraft.server.v1_7_R4.Block.getById(block.getTypeId()).a(
|
||||
(net.minecraft.server.v1_7_R4.Entity) null) * 0.7F;
|
||||
|
||||
if (strength <= heat)
|
||||
{
|
||||
block.setType(Material.AIR);
|
||||
|
||||
block.getWorld().playSound(block.getLocation(), Sound.FIZZ, 1.3F,
|
||||
0.6F + ((new Random().nextFloat() - 0.5F) / 3F));
|
||||
}
|
||||
else if (0.2 <= heat)
|
||||
{
|
||||
if (_glazedBlocks.containsKey(block.getType()))
|
||||
{
|
||||
block.setType(_glazedBlocks.get(block.getType()));
|
||||
|
||||
if (block.getType() == Material.STAINED_CLAY)
|
||||
{
|
||||
block.setData((byte) 8);
|
||||
}
|
||||
|
||||
block.getWorld().playSound(block.getLocation(), Sound.FIZZ, 1.3F,
|
||||
0.6F + ((new Random().nextFloat() - 0.5F) / 3F));
|
||||
}
|
||||
}
|
||||
else if (strength * 2 > size)
|
||||
{
|
||||
tempIgnore.put(block, heat);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (block.getType() == Material.WATER || block.getType() == Material.STATIONARY_WATER)
|
||||
{
|
||||
if (heat > 1)
|
||||
{
|
||||
block.setType(Material.AIR);
|
||||
|
||||
block.getWorld().playSound(block.getLocation(), Sound.FIZZ, 1.3F, 0);
|
||||
|
||||
litOnFire.add(block);
|
||||
}
|
||||
}
|
||||
else if (block.getType() == Material.AIR)
|
||||
{
|
||||
if (UtilMath.random.nextBoolean())
|
||||
{
|
||||
for (int a = 0; a < 6; a++)
|
||||
{
|
||||
Block b = block.getRelative(BlockFace.values()[a]);
|
||||
|
||||
if (b.getType() != Material.AIR)
|
||||
{
|
||||
block.setType(Material.FIRE);
|
||||
block.getWorld().playSound(block.getLocation(), Sound.DIG_WOOL, 1.3F,
|
||||
0.6F + ((new Random().nextFloat() - 0.5F) / 3F));
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
litOnFire.add(block);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
size = Math.min(8, size + 0.06);
|
||||
}
|
||||
|
||||
blocksTravelled += 0.15;
|
||||
|
||||
if (lastTick++ % 8 == 0)
|
||||
{
|
||||
napalmLoc.getWorld().playSound(napalmLoc, Sound.CAT_HISS, Math.min(0.8F + (float) (size * 0.09F), 1.8f), 0F);
|
||||
}
|
||||
|
||||
if (blocksTravelled >= length)
|
||||
{
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(Wizards.getArcadeManager().getPlugin(), 0, 1);
|
||||
|
||||
charge(player);
|
||||
}
|
||||
}
|
@ -17,47 +17,57 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
public class SpellRainbowBeam extends Spell implements SpellClick
|
||||
{
|
||||
|
||||
@Override
|
||||
public void castSpell(Player p)
|
||||
{
|
||||
Entity entityTarget = UtilPlayer.getEntityInSight(p, 20 * getSpellLevel(p), true, true, true, 1.9F);
|
||||
@Override
|
||||
public void castSpell(Player p)
|
||||
{
|
||||
Entity entityTarget = UtilPlayer.getEntityInSight(p, 80, true, true, true, 1.9F);
|
||||
|
||||
if (!(entityTarget instanceof LivingEntity))
|
||||
{
|
||||
entityTarget = null;
|
||||
}
|
||||
if (!(entityTarget instanceof LivingEntity))
|
||||
{
|
||||
entityTarget = null;
|
||||
}
|
||||
|
||||
Location loc;
|
||||
if (entityTarget != null)
|
||||
{
|
||||
Location loc;
|
||||
if (entityTarget != null)
|
||||
{
|
||||
|
||||
loc = p.getEyeLocation().add(
|
||||
p.getEyeLocation().getDirection().normalize()
|
||||
.multiply(0.3 + p.getEyeLocation().distance(((LivingEntity) entityTarget).getEyeLocation())));
|
||||
loc = p.getEyeLocation().add(
|
||||
p.getEyeLocation().getDirection().normalize()
|
||||
.multiply(0.3 + p.getEyeLocation().distance(((LivingEntity) entityTarget).getEyeLocation())));
|
||||
|
||||
// The above code makes the beam appear to hit them where you aimed.
|
||||
Wizards.getArcadeManager()
|
||||
.GetDamage()
|
||||
.NewDamageEvent((LivingEntity) entityTarget, p, null, DamageCause.CUSTOM, (getSpellLevel(p) * 2) + 4F, true,
|
||||
true, false, "Rainbow Beam", "Rainbow Beam");
|
||||
double damage = (getSpellLevel(p) * 2) + 4;
|
||||
double dist = loc.distance(p.getLocation()) - (80 * .2D);
|
||||
|
||||
p.playSound(entityTarget.getLocation(), Sound.LEVEL_UP, (getSpellLevel(p) * 2) + 6, 1);
|
||||
// If target is more than 20% away
|
||||
if (dist > 0)
|
||||
{
|
||||
damage -= damage * (dist / (80 * .8D));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
loc = p.getLastTwoTargetBlocks(UtilBlock.blockAirFoliageSet, 20 * getSpellLevel(p)).get(0).getLocation()
|
||||
.add(0.5, 0.5, 0.5);
|
||||
}
|
||||
damage = Math.max(1, damage);
|
||||
}
|
||||
|
||||
for (Location l : UtilShapes.getLinesDistancedPoints(p.getEyeLocation().subtract(0, 0.1, 0), loc, 1))
|
||||
{
|
||||
l.getWorld().spigot().playEffect(l, Effect.POTION_SWIRL, 0, 0, 0, 0, 0, 500, 1, 30);
|
||||
}
|
||||
// The above code makes the beam appear to hit them where you aimed.
|
||||
Wizards.getArcadeManager()
|
||||
.GetDamage()
|
||||
.NewDamageEvent((LivingEntity) entityTarget, p, null, DamageCause.MAGIC, damage, true, true, false,
|
||||
"Rainbow Beam", "Rainbow Beam");
|
||||
|
||||
p.playSound(p.getLocation(), Sound.LEVEL_UP, 1.5F, 1);
|
||||
p.playSound(entityTarget.getLocation(), Sound.LEVEL_UP, (getSpellLevel(p) * 2) + 6, 1);
|
||||
|
||||
charge(p);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
loc = p.getLastTwoTargetBlocks(UtilBlock.blockAirFoliageSet, 80).get(0).getLocation().add(0.5, 0.5, 0.5);
|
||||
}
|
||||
|
||||
for (Location l : UtilShapes.getLinesDistancedPoints(p.getEyeLocation().subtract(0, 0.1, 0), loc, 0.3))
|
||||
{
|
||||
l.getWorld().spigot().playEffect(l, Effect.POTION_SWIRL, 0, 0, 0, 0, 0, 500, 1, 30);
|
||||
}
|
||||
|
||||
p.playSound(p.getLocation(), Sound.LEVEL_UP, 1.5F, 1);
|
||||
|
||||
charge(p);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,147 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilShapes;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class SpellRainbowRoad extends Spell implements SpellClick
|
||||
{
|
||||
final BlockFace[] radial =
|
||||
{
|
||||
BlockFace.SOUTH, BlockFace.SOUTH_WEST, BlockFace.WEST, BlockFace.NORTH_WEST, BlockFace.NORTH,
|
||||
BlockFace.NORTH_EAST, BlockFace.EAST, BlockFace.SOUTH_EAST
|
||||
};
|
||||
final int[] _rainbow = new int[]
|
||||
{
|
||||
1, 2, 3, 4, 5, 6, 9, 10, 11, 13, 14
|
||||
};
|
||||
|
||||
private HashMap<Block, Long> _wallExpires = new HashMap<Block, Long>();
|
||||
|
||||
@EventHandler
|
||||
public void onUpdate(UpdateEvent event)
|
||||
{
|
||||
Iterator<Entry<Block, Long>> itel = _wallExpires.entrySet().iterator();
|
||||
|
||||
while (itel.hasNext())
|
||||
{
|
||||
Entry<Block, Long> entry = itel.next();
|
||||
|
||||
if (entry.getValue() < System.currentTimeMillis())
|
||||
{
|
||||
itel.remove();
|
||||
|
||||
if (entry.getKey().getType() == Material.STAINED_GLASS)
|
||||
{
|
||||
entry.getKey().setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void castSpell(Player p)
|
||||
{
|
||||
final BlockFace face = radial[Math.round(p.getLocation().getYaw() / 45f) & 0x7];
|
||||
|
||||
double yMod = Math.min(Math.max(p.getLocation().getPitch() / 30, -1), 1);
|
||||
|
||||
final Vector vector = new Vector(face.getModX(), -yMod, face.getModZ());
|
||||
|
||||
final Location loc = p.getLocation().getBlock().getLocation().add(0.5, -0.5, 0.5);
|
||||
|
||||
final int maxDist = 3 + (10 * getSpellLevel(p));
|
||||
|
||||
makeRoad(loc, face, 0);
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
int blocks;
|
||||
int colorProgress;
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (!Wizards.IsLive() || blocks++ >= maxDist)
|
||||
{
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
colorProgress = makeRoad(loc, face, colorProgress);
|
||||
|
||||
loc.add(vector);
|
||||
}
|
||||
}.runTaskTimer(Wizards.getArcadeManager().getPlugin(), 5, 5);
|
||||
|
||||
charge(p);
|
||||
}
|
||||
|
||||
private int makeRoad(Location loc, BlockFace face, int colorProgress)
|
||||
{
|
||||
Block block = loc.getBlock();
|
||||
|
||||
BlockFace[] faces = UtilShapes.getSideBlockFaces(face);
|
||||
|
||||
ArrayList<Block> bs = new ArrayList<Block>();
|
||||
|
||||
bs.add(block);
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
bs.add(block.getRelative(faces[i]));
|
||||
}
|
||||
|
||||
bs.addAll(UtilShapes.getDiagonalBlocks(block, face, 1));
|
||||
|
||||
boolean playSound = false;
|
||||
|
||||
for (Block b : bs)
|
||||
{
|
||||
if (!Wizards.isInsideMap(b.getLocation()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!_wallExpires.containsKey(block) && UtilBlock.solid(b))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
b.setType(Material.STAINED_GLASS);
|
||||
b.setData((byte) _rainbow[colorProgress++ % _rainbow.length]);
|
||||
|
||||
b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, Material.WOOL, b.getData());
|
||||
|
||||
_wallExpires.put(b, System.currentTimeMillis() + ((20 + UtilMath.r(10)) * 1000L));
|
||||
|
||||
playSound = true;
|
||||
}
|
||||
|
||||
if (playSound)
|
||||
{
|
||||
block.getWorld().playSound(block.getLocation(), Sound.ZOMBIE_UNFECT, 1.5F, 1);
|
||||
}
|
||||
|
||||
return colorProgress;
|
||||
}
|
||||
}
|
@ -3,13 +3,17 @@ package nautilus.game.arcade.game.games.wizards.spells;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilShapes;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClickBlock;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.AnimalTamer;
|
||||
@ -17,164 +21,332 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Tameable;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class SpellRumble extends Spell implements SpellClickBlock, SpellClick
|
||||
{
|
||||
|
||||
final private BlockFace[] _radial =
|
||||
{
|
||||
BlockFace.SOUTH, BlockFace.SOUTH_WEST, BlockFace.WEST, BlockFace.NORTH_WEST, BlockFace.NORTH,
|
||||
BlockFace.NORTH_EAST, BlockFace.EAST, BlockFace.SOUTH_EAST
|
||||
};
|
||||
final private BlockFace[] _radial =
|
||||
{
|
||||
BlockFace.SOUTH, BlockFace.SOUTH_WEST, BlockFace.WEST, BlockFace.NORTH_WEST, BlockFace.NORTH,
|
||||
BlockFace.NORTH_EAST, BlockFace.EAST, BlockFace.SOUTH_EAST
|
||||
};
|
||||
|
||||
public void castSpell(Player player)
|
||||
{
|
||||
Block block = player.getLocation().add(0, -1, 0).getBlock();
|
||||
public void castSpell(Player player)
|
||||
{
|
||||
Block block = player.getLocation().add(0, -1, 0).getBlock();
|
||||
|
||||
if (!UtilBlock.solid(block))
|
||||
{
|
||||
block = block.getRelative(BlockFace.DOWN);
|
||||
}
|
||||
if (!UtilBlock.solid(block))
|
||||
{
|
||||
block = block.getRelative(BlockFace.DOWN);
|
||||
}
|
||||
|
||||
castSpell(player, block);
|
||||
}
|
||||
castSpell(player, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void castSpell(final Player player, final Block target)
|
||||
{
|
||||
@EventHandler
|
||||
public void onDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.GetReason() != null && event.GetReason().equals("Rumble"))
|
||||
{
|
||||
event.AddKnockback("Rumble", 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (UtilBlock.solid(target))
|
||||
{
|
||||
@Override
|
||||
public void castSpell(final Player player, final Block target)
|
||||
{
|
||||
|
||||
final BlockFace moveDirection = _radial[Math.round(player.getEyeLocation().getYaw() / 45f) & 0x7];
|
||||
final int spellLevel = getSpellLevel(player);
|
||||
final int damage = 4 + (spellLevel * 2);
|
||||
final int maxDist = 10 * spellLevel;
|
||||
if (UtilBlock.solid(target))
|
||||
{
|
||||
|
||||
player.getWorld().playEffect(target.getLocation(), Effect.STEP_SOUND, target.getTypeId());
|
||||
final BlockFace moveDirection = _radial[Math.round(player.getEyeLocation().getYaw() / 45f) & 0x7];
|
||||
final int spellLevel = getSpellLevel(player);
|
||||
final int damage = 4 + (spellLevel * 2);
|
||||
final int maxDist = 10 * spellLevel;
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
private Block _currentBlock = target;
|
||||
private int _distTravelled = 0;
|
||||
private ArrayList<Integer> _effected = new ArrayList<Integer>();
|
||||
private ArrayList<Block> _previousBlocks = new ArrayList<Block>();
|
||||
playBlockEffect(target);
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (!player.isOnline() || !Wizards.IsAlive(player))
|
||||
{
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
new BukkitRunnable()
|
||||
{
|
||||
private Block _currentBlock = target;
|
||||
private int _distTravelled = 0;
|
||||
private ArrayList<Integer> _effected = new ArrayList<Integer>();
|
||||
private ArrayList<Block> _previousBlocks = new ArrayList<Block>();
|
||||
|
||||
_currentBlock = _currentBlock.getRelative(moveDirection);
|
||||
private void endRun()
|
||||
{
|
||||
ArrayList<Block> bs = new ArrayList<Block>();
|
||||
|
||||
if (UtilBlock.solid(_currentBlock.getRelative(BlockFace.UP)))
|
||||
{
|
||||
BlockFace[] faces = UtilShapes.getSideBlockFaces(moveDirection);
|
||||
|
||||
_currentBlock = _currentBlock.getRelative(BlockFace.UP);
|
||||
bs.add(_currentBlock);
|
||||
|
||||
if (UtilBlock.solid(_currentBlock.getRelative(BlockFace.UP)))
|
||||
{
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
for (int i = 1; i <= Math.min(4, Math.floor(_distTravelled / (8D - spellLevel))) + 1; i++)
|
||||
{
|
||||
for (int a = 0; a < faces.length; a++)
|
||||
{
|
||||
Block b = _currentBlock.getRelative(faces[a], i);
|
||||
|
||||
}
|
||||
else if (!UtilBlock.solid(_currentBlock) && _currentBlock.getY() > 0)
|
||||
{
|
||||
if (UtilBlock.solid(b))
|
||||
{
|
||||
bs.add(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_currentBlock = _currentBlock.getRelative(BlockFace.DOWN);
|
||||
for (Block block : bs)
|
||||
{
|
||||
|
||||
}
|
||||
ArrayList<Block> toExplode = new ArrayList<Block>();
|
||||
|
||||
if (!UtilBlock.solid(_currentBlock))
|
||||
{
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
toExplode.add(block);
|
||||
|
||||
ArrayList<Block> bs = new ArrayList<Block>();
|
||||
for (BlockFace face : new BlockFace[]
|
||||
{
|
||||
BlockFace.EAST, BlockFace.WEST, BlockFace.SOUTH, BlockFace.NORTH, BlockFace.UP,
|
||||
BlockFace.DOWN
|
||||
})
|
||||
{
|
||||
if (UtilMath.random.nextBoolean())
|
||||
{
|
||||
Block b = block.getRelative(face);
|
||||
|
||||
BlockFace[] faces = UtilShapes.getSideBlockFaces(_currentBlock, moveDirection);
|
||||
if (b.getType() != Material.AIR && b.getType() != Material.BEDROCK)
|
||||
{
|
||||
if (!toExplode.contains(b))
|
||||
{
|
||||
toExplode.add(b);
|
||||
b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, b.getTypeId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bs.add(_currentBlock);
|
||||
Wizards.getArcadeManager().GetExplosion()
|
||||
.BlockExplosion(toExplode, block.getLocation().add(0.5, 0, 0.5), false);
|
||||
|
||||
for (int i = 1; i <= Math.min(4, Math.floor(_distTravelled / (8D - spellLevel))) + 1; i++)
|
||||
{
|
||||
for (int a = 0; a < faces.length; a++)
|
||||
{
|
||||
Block b = _currentBlock.getRelative(faces[a], i);
|
||||
for (LivingEntity entity : block.getWorld().getEntitiesByClass(LivingEntity.class))
|
||||
{
|
||||
if (!UtilPlayer.isSpectator(entity))
|
||||
{
|
||||
if (entity instanceof Tameable)
|
||||
{
|
||||
AnimalTamer tamer = ((Tameable) entity).getOwner();
|
||||
|
||||
if (UtilBlock.solid(b))
|
||||
{
|
||||
bs.add(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tamer != null && tamer == player)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
_previousBlocks.addAll(bs);
|
||||
double dist = 999;
|
||||
|
||||
for (Block b : _previousBlocks)
|
||||
{
|
||||
for (Entity entity : b.getChunk().getEntities())
|
||||
{
|
||||
if (entity instanceof LivingEntity && player != entity && !_effected.contains(entity.getEntityId()))
|
||||
{
|
||||
for (Block b : toExplode)
|
||||
{
|
||||
double currentDist = b.getLocation().add(0.5, 0.5, 0.5).distance(entity.getLocation());
|
||||
|
||||
if (entity instanceof Tameable)
|
||||
{
|
||||
AnimalTamer tamer = ((Tameable) entity).getOwner();
|
||||
if (dist > currentDist)
|
||||
{
|
||||
dist = currentDist;
|
||||
}
|
||||
}
|
||||
|
||||
if (tamer != null && tamer == player)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (dist < 2)
|
||||
{
|
||||
Wizards.getArcadeManager()
|
||||
.GetDamage()
|
||||
.NewDamageEvent(entity, player, null, DamageCause.ENTITY_EXPLOSION,
|
||||
(1 + (spellLevel / 5D)) * (2 - dist), true, true, false, "Rumble Explosion",
|
||||
"Rumble Explosion");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Location loc = entity.getLocation();
|
||||
cancel();
|
||||
}
|
||||
|
||||
if (loc.getBlockX() == b.getX() && loc.getBlockZ() == b.getZ())
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (!player.isOnline() || !Wizards.IsAlive(player))
|
||||
{
|
||||
endRun();
|
||||
return;
|
||||
}
|
||||
|
||||
if (entity instanceof Player && !Wizards.IsAlive(entity))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
boolean found = false;
|
||||
|
||||
double height = loc.getY() - b.getY();
|
||||
if (height >= 0 && height <= 2)
|
||||
{
|
||||
Wizards.Manager.GetDamage().NewDamageEvent((LivingEntity) entity, player, null,
|
||||
DamageCause.CUSTOM, damage, false, true, false, "Rumble", "Rumble");
|
||||
}
|
||||
for (int y : new int[]
|
||||
{
|
||||
0, 1, -1, -2
|
||||
})
|
||||
{
|
||||
if (_currentBlock.getY() + y <= 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
_effected.add(entity.getEntityId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Block b = _currentBlock.getRelative(moveDirection).getRelative(0, y, 0);
|
||||
|
||||
_previousBlocks = bs;
|
||||
if (UtilBlock.solid(b) && !UtilBlock.solid(b.getRelative(0, 1, 0)))
|
||||
{
|
||||
found = true;
|
||||
_currentBlock = b;
|
||||
|
||||
for (Block b : bs)
|
||||
{
|
||||
b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, b.getTypeId(), 19); // 19 being particle view
|
||||
// distance
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (_distTravelled++ >= maxDist)
|
||||
{
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(Wizards.getArcadeManager().getPlugin(), 5, 1);
|
||||
if (!found)
|
||||
{
|
||||
endRun();
|
||||
return;
|
||||
}
|
||||
|
||||
charge(player);
|
||||
}
|
||||
}
|
||||
ArrayList<Block> effectedBlocks = new ArrayList<Block>();
|
||||
|
||||
BlockFace[] faces = UtilShapes.getSideBlockFaces(moveDirection);
|
||||
|
||||
effectedBlocks.add(_currentBlock);
|
||||
|
||||
playBlockEffect(_currentBlock);
|
||||
|
||||
int size = (int) (Math.min(4, Math.floor(_distTravelled / (8D - spellLevel))) + 1);
|
||||
|
||||
for (int i = 1; i <= size; i++)
|
||||
{
|
||||
for (int a = 0; a < faces.length; a++)
|
||||
{
|
||||
Block b = _currentBlock.getRelative(faces[a], i);
|
||||
|
||||
if (UtilBlock.solid(b))
|
||||
{
|
||||
effectedBlocks.add(b);
|
||||
playBlockEffect(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Block b : UtilShapes.getDiagonalBlocks(_currentBlock, moveDirection, size - 2))
|
||||
{
|
||||
if (UtilBlock.solid(b))
|
||||
{
|
||||
effectedBlocks.add(b);
|
||||
playBlockEffect(b);
|
||||
}
|
||||
}
|
||||
|
||||
_previousBlocks.addAll(effectedBlocks);
|
||||
|
||||
for (Block b : _previousBlocks)
|
||||
{
|
||||
for (Entity entity : b.getChunk().getEntities())
|
||||
{
|
||||
if (entity instanceof LivingEntity && player != entity && !_effected.contains(entity.getEntityId()))
|
||||
{
|
||||
|
||||
if (entity instanceof Tameable)
|
||||
{
|
||||
AnimalTamer tamer = ((Tameable) entity).getOwner();
|
||||
|
||||
if (tamer != null && tamer == player)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
Location loc = entity.getLocation();
|
||||
|
||||
if (loc.getBlockX() == b.getX() && loc.getBlockZ() == b.getZ())
|
||||
{
|
||||
|
||||
if (entity instanceof Player && !Wizards.IsAlive(entity))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
double height = loc.getY() - b.getY();
|
||||
if (height >= 0 && height <= 3)
|
||||
{
|
||||
Wizards.Manager.GetDamage().NewDamageEvent((LivingEntity) entity, player, null,
|
||||
DamageCause.CONTACT, damage, true, true, false, "Rumble", "Rumble");
|
||||
|
||||
if (entity instanceof Player)
|
||||
{
|
||||
Wizards.getArcadeManager()
|
||||
.GetCondition()
|
||||
.Factory()
|
||||
.Slow("Rumble", (LivingEntity) entity, player, 3, spellLevel, false, false,
|
||||
false, false);
|
||||
}
|
||||
}
|
||||
|
||||
_effected.add(entity.getEntityId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_previousBlocks = effectedBlocks;
|
||||
|
||||
if (_distTravelled++ >= maxDist)
|
||||
{
|
||||
endRun();
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(Wizards.getArcadeManager().getPlugin(), 5, 1);
|
||||
|
||||
charge(player);
|
||||
}
|
||||
}
|
||||
|
||||
private void playBlockEffect(Block block)
|
||||
{
|
||||
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
|
||||
Block b = block.getRelative(BlockFace.UP);
|
||||
|
||||
if (UtilBlock.airFoliage(b))
|
||||
{
|
||||
b.breakNaturally();
|
||||
}
|
||||
/*
|
||||
|
||||
final int entityId = UtilEnt.getNewEntityId();
|
||||
|
||||
PacketPlayOutSpawnEntity fallingSpawn = new PacketPlayOutSpawnEntity();
|
||||
fallingSpawn.a = entityId;
|
||||
fallingSpawn.b = (block.getX() * 32) + 16;
|
||||
fallingSpawn.c = (block.getY() * 32) + 4;
|
||||
fallingSpawn.d = (block.getZ() * 32) + 16;
|
||||
fallingSpawn.i = 70;
|
||||
fallingSpawn.k = block.getTypeId() | block.getData() << 16;
|
||||
fallingSpawn.f = 10000;
|
||||
|
||||
final Collection<? extends Player> players = Bukkit.getOnlinePlayers();
|
||||
|
||||
for (Player player : players)
|
||||
{
|
||||
UtilPlayer.sendPacket(player, fallingSpawn);
|
||||
}
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(Wizards.getArcadeManager().getPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(new int[]
|
||||
{
|
||||
entityId
|
||||
});
|
||||
|
||||
for (Player player : players)
|
||||
{
|
||||
UtilPlayer.sendPacket(player, destroyPacket);
|
||||
}
|
||||
}
|
||||
}, 15);*/
|
||||
}
|
||||
}
|
@ -0,0 +1,103 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilShapes;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftArrow;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
public class SpellSpectralArrow extends Spell implements SpellClick
|
||||
{
|
||||
private HashMap<Arrow, Location[]> _spectralArrows = new HashMap<Arrow, Location[]>();
|
||||
|
||||
@Override
|
||||
public void castSpell(Player player)
|
||||
{
|
||||
Arrow arrow = player.launchProjectile(Arrow.class);
|
||||
|
||||
arrow.setVelocity(arrow.getVelocity().multiply(2.3));
|
||||
|
||||
arrow.setMetadata("SpellLevel", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), getSpellLevel(player)));
|
||||
|
||||
((CraftArrow) arrow).getHandle().fromPlayer = 0;
|
||||
|
||||
_spectralArrows.put(arrow, new Location[]
|
||||
{
|
||||
player.getLocation(), player.getLocation()
|
||||
});
|
||||
|
||||
charge(player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onTick(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Iterator<Entry<Arrow, Location[]>> itel = _spectralArrows.entrySet().iterator();
|
||||
|
||||
while (itel.hasNext())
|
||||
{
|
||||
Entry<Arrow, Location[]> entry = itel.next();
|
||||
|
||||
for (Location loc : UtilShapes.getLinesDistancedPoints(entry.getValue()[1], entry.getKey().getLocation(), 0.7D))
|
||||
{
|
||||
UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, loc, 0, 0, 0, 0, 1);
|
||||
}
|
||||
|
||||
entry.getValue()[1] = entry.getKey().getLocation();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onSecond(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Iterator<Arrow> itel = _spectralArrows.keySet().iterator();
|
||||
|
||||
while (itel.hasNext())
|
||||
{
|
||||
Arrow entity = itel.next();
|
||||
|
||||
if (entity.isOnGround() || !entity.isValid())
|
||||
{
|
||||
itel.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDamage(CustomDamageEvent event)
|
||||
{
|
||||
Location[] loc = _spectralArrows.remove(event.GetProjectile());
|
||||
|
||||
if (loc != null)
|
||||
{
|
||||
int spellLevel = event.GetProjectile().getMetadata("SpellLevel").get(0).asInt();
|
||||
|
||||
event.AddMod("Negate Damage", "Negate Damage", -event.GetDamage(), false);
|
||||
event.AddMod("Spectral Arrow", "Spectral Arrow", 6 + loc[0].distance(event.GetDamageeEntity().getLocation())
|
||||
/ (7D - spellLevel), true);
|
||||
}
|
||||
}
|
||||
}
|
@ -7,14 +7,11 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class SpellSpeedBoost extends Spell implements SpellClick
|
||||
{
|
||||
@Override
|
||||
public void castSpell(Player p)
|
||||
{
|
||||
int ticks = 30 * getSpellLevel(p) * 20;
|
||||
int potionLevel = getSpellLevel(p);
|
||||
@Override
|
||||
public void castSpell(Player p)
|
||||
{
|
||||
Wizards.getArcadeManager().GetCondition().Factory().Speed("Speed Boost", p, p, 20, getSpellLevel(p), false, false, false);
|
||||
|
||||
Wizards.getArcadeManager().GetCondition().Factory().Speed("Speed Boost", p, p, ticks, potionLevel, false, false, false);
|
||||
|
||||
charge(p);
|
||||
}
|
||||
charge(p);
|
||||
}
|
||||
}
|
||||
|
@ -1,77 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class SpellSpiderman extends Spell implements SpellClick
|
||||
{
|
||||
|
||||
@Override
|
||||
public void castSpell(final Player player)
|
||||
{
|
||||
shoot(player);
|
||||
|
||||
for (int i = 1; i < getSpellLevel(player) * 2; i++)
|
||||
{
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(Wizards.getArcadeManager().getPlugin(), new Runnable()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
shoot(player);
|
||||
}
|
||||
|
||||
}, i * 10);
|
||||
}
|
||||
|
||||
charge(player);
|
||||
}
|
||||
|
||||
private void shoot(Player player)
|
||||
{
|
||||
|
||||
if (Wizards.IsAlive(player))
|
||||
{
|
||||
|
||||
final FallingBlock block = player.getWorld().spawnFallingBlock(player.getEyeLocation(), Material.WEB, (byte) 0);
|
||||
block.setVelocity(player.getEyeLocation().getDirection().multiply(2));
|
||||
block.getWorld().playSound(block.getLocation(), Sound.CLICK, 0.5F, 0);
|
||||
block.setDropItem(false);
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
|
||||
if (!Wizards.IsLive())
|
||||
{
|
||||
cancel();
|
||||
}
|
||||
else if (!block.isValid())
|
||||
{
|
||||
cancel();
|
||||
|
||||
Block b = block.getLocation().getBlock();
|
||||
|
||||
if (UtilBlock.airFoliage(b) && b.getType() != Material.WEB)
|
||||
{
|
||||
b.setType(Material.WEB);
|
||||
}
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(Wizards.getArcadeManager().getPlugin(), 0, 0);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -1,103 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilShapes;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClickBlock;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class SpellStoneWall extends Spell implements SpellClickBlock
|
||||
{
|
||||
private HashMap<Block, Long> _wallExpires = new HashMap<Block, Long>();
|
||||
|
||||
@EventHandler
|
||||
public void onUpdate(UpdateEvent event)
|
||||
{
|
||||
Iterator<Entry<Block, Long>> itel = _wallExpires.entrySet().iterator();
|
||||
|
||||
while (itel.hasNext())
|
||||
{
|
||||
Entry<Block, Long> entry = itel.next();
|
||||
|
||||
if (entry.getValue() < System.currentTimeMillis())
|
||||
{
|
||||
itel.remove();
|
||||
|
||||
if (entry.getKey().getType() == Material.STONE)
|
||||
{
|
||||
entry.getKey().setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void castSpell(Player player, Block obj)
|
||||
{
|
||||
final Block starter = obj.getRelative(BlockFace.UP);
|
||||
final int wallWidth = getSpellLevel(player) * 5;
|
||||
final BlockFace facing = UtilShapes.getFacing(player.getEyeLocation().getYaw());
|
||||
final int wallHeight = 1 + getSpellLevel(player);
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
Block block = starter;
|
||||
int currentRun;
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
|
||||
currentRun++;
|
||||
|
||||
BlockFace[] faces = UtilShapes.getCornerBlockFaces(block, facing);
|
||||
|
||||
if (block.getType() == Material.AIR)
|
||||
{
|
||||
block.setTypeIdAndData(Material.STONE.getId(), (byte) 0, false);
|
||||
_wallExpires.put(block, System.currentTimeMillis() + ((20 + UtilMath.r(10)) * 1000L));
|
||||
}
|
||||
|
||||
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
|
||||
|
||||
for (BlockFace face : faces)
|
||||
{
|
||||
for (int i = 1; i < wallWidth; i++)
|
||||
{
|
||||
|
||||
Block b = block.getRelative(face.getModX() * i, 0, face.getModZ() * i);
|
||||
|
||||
if (!UtilBlock.airFoliage(b))
|
||||
break;
|
||||
|
||||
b.setTypeIdAndData(Material.STONE.getId(), (byte) 0, false);
|
||||
b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, b.getTypeId());
|
||||
|
||||
_wallExpires.put(b, System.currentTimeMillis() + ((20 + UtilMath.r(10)) * 1000L));
|
||||
}
|
||||
}
|
||||
|
||||
block = block.getRelative(BlockFace.UP);
|
||||
if (currentRun >= wallHeight)
|
||||
{
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(Wizards.getArcadeManager().getPlugin(), 0, 5);
|
||||
|
||||
charge(player);
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Random;
|
||||
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
@ -29,137 +30,137 @@ import org.bukkit.event.EventHandler;
|
||||
public class SpellSummonWolves extends Spell implements SpellClick, SpellClickBlock
|
||||
{
|
||||
|
||||
private HashMap<Wolf, Long> _summonedWolves = new HashMap<Wolf, Long>();
|
||||
private HashMap<Wolf, Long> _summonedWolves = new HashMap<Wolf, Long>();
|
||||
|
||||
@Override
|
||||
public void castSpell(Player player, Block block)
|
||||
{
|
||||
block = block.getRelative(BlockFace.UP);
|
||||
@Override
|
||||
public void castSpell(Player player, Block block)
|
||||
{
|
||||
block = block.getRelative(BlockFace.UP);
|
||||
|
||||
if (!UtilBlock.airFoliage(block))
|
||||
{
|
||||
block = player.getLocation().getBlock();
|
||||
}
|
||||
if (!UtilBlock.airFoliage(block))
|
||||
{
|
||||
block = player.getLocation().getBlock();
|
||||
}
|
||||
|
||||
Location loc = block.getLocation().add(0.5, 0, 0.5);
|
||||
Location loc = block.getLocation().add(0.5, 0, 0.5);
|
||||
|
||||
for (int i = 0; i < 2 + getSpellLevel(player); i++)
|
||||
{
|
||||
Wizards.CreatureAllowOverride = true;
|
||||
for (int i = 0; i < getSpellLevel(player); i++)
|
||||
{
|
||||
Wizards.CreatureAllowOverride = true;
|
||||
|
||||
Wolf wolf = (Wolf) player.getWorld().spawnEntity(loc, EntityType.WOLF);
|
||||
Wolf wolf = (Wolf) player.getWorld().spawnEntity(
|
||||
loc.clone().add(new Random().nextFloat() - 0.5F, 0, new Random().nextFloat() - 0.5F), EntityType.WOLF);
|
||||
|
||||
Wizards.CreatureAllowOverride = false;
|
||||
Wizards.CreatureAllowOverride = false;
|
||||
|
||||
wolf.setCollarColor(DyeColor.YELLOW);
|
||||
wolf.setTamed(true);
|
||||
wolf.setOwner(player);
|
||||
wolf.setBreed(false);
|
||||
wolf.setCustomName(player.getDisplayName() + "'s Wolf");
|
||||
wolf.setRemoveWhenFarAway(false);
|
||||
wolf.setMaxHealth(2);
|
||||
wolf.setHealth(2);
|
||||
// wolf.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 9001, 0));
|
||||
wolf.setCollarColor(DyeColor.YELLOW);
|
||||
wolf.setTamed(true);
|
||||
wolf.setOwner(player);
|
||||
wolf.setBreed(false);
|
||||
wolf.setCustomName(player.getDisplayName() + "'s Wolf");
|
||||
wolf.setRemoveWhenFarAway(false);
|
||||
wolf.setMaxHealth(0.5);
|
||||
wolf.setHealth(0.5);
|
||||
|
||||
this._summonedWolves.put(wolf, System.currentTimeMillis() + (30L * 1000L));
|
||||
}
|
||||
_summonedWolves.put(wolf, System.currentTimeMillis() + (30L * 1000L));
|
||||
}
|
||||
|
||||
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, loc, 0.8F, 0, 0.8F, 0, 4);
|
||||
player.getWorld().playSound(player.getLocation(), Sound.BAT_TAKEOFF, 1.2F, 1);
|
||||
charge(player);
|
||||
}
|
||||
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, loc, 0.8F, 0, 0.8F, 0, 4);
|
||||
player.getWorld().playSound(player.getLocation(), Sound.BAT_TAKEOFF, 1.2F, 1);
|
||||
charge(player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.GetDamagerEntity(false) instanceof Wolf)
|
||||
{
|
||||
Wolf wolf = (Wolf) event.GetDamagerEntity(false);
|
||||
event.AddMult("Summoned Wolf", "Summoned Wolf", 0.3, true);
|
||||
|
||||
AnimalTamer tamer = wolf.getOwner();
|
||||
if (tamer instanceof Player)
|
||||
{
|
||||
event.SetDamager((Player) tamer);
|
||||
event.setKnockbackOrigin(wolf.getLocation());
|
||||
}
|
||||
}
|
||||
}
|
||||
@EventHandler
|
||||
public void onDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.GetDamagerEntity(false) instanceof Wolf)
|
||||
{
|
||||
Wolf wolf = (Wolf) event.GetDamagerEntity(false);
|
||||
event.AddMult("Summoned Wolf", "Summoned Wolf", 0.3, true);
|
||||
|
||||
@EventHandler
|
||||
public void onSecond(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() == UpdateType.SEC)
|
||||
{
|
||||
AnimalTamer tamer = wolf.getOwner();
|
||||
if (tamer instanceof Player)
|
||||
{
|
||||
event.SetDamager((Player) tamer);
|
||||
event.setKnockbackOrigin(wolf.getLocation());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Iterator<Wolf> itel = _summonedWolves.keySet().iterator();
|
||||
@EventHandler
|
||||
public void onSecond(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() == UpdateType.SEC)
|
||||
{
|
||||
|
||||
while (itel.hasNext())
|
||||
{
|
||||
Wolf wolf = itel.next();
|
||||
AnimalTamer wolfOwner = wolf.getOwner();
|
||||
Iterator<Wolf> itel = _summonedWolves.keySet().iterator();
|
||||
|
||||
if (!wolf.isValid() || _summonedWolves.get(wolf) < System.currentTimeMillis() || !(wolfOwner instanceof Player)
|
||||
|| !Wizards.IsAlive((Entity) wolfOwner))
|
||||
{
|
||||
if (wolf.isValid())
|
||||
{
|
||||
wolf.getWorld().playEffect(wolf.getLocation(), Effect.EXPLOSION_HUGE, 0);
|
||||
}
|
||||
while (itel.hasNext())
|
||||
{
|
||||
Wolf wolf = itel.next();
|
||||
AnimalTamer wolfOwner = wolf.getOwner();
|
||||
|
||||
wolf.remove();
|
||||
itel.remove();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!wolf.isValid() || _summonedWolves.get(wolf) < System.currentTimeMillis() || !(wolfOwner instanceof Player)
|
||||
|| !Wizards.IsAlive((Entity) wolfOwner))
|
||||
{
|
||||
if (wolf.isValid())
|
||||
{
|
||||
wolf.getWorld().playEffect(wolf.getLocation(), Effect.EXPLOSION_HUGE, 0);
|
||||
}
|
||||
|
||||
if (wolf.getTarget() == null || !wolf.getTarget().isValid() || !Wizards.IsAlive(wolf.getTarget())
|
||||
|| wolf.getTarget().getLocation().distance(wolf.getLocation()) > 16)
|
||||
{
|
||||
wolf.remove();
|
||||
itel.remove();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
double dist = 0;
|
||||
Player target = null;
|
||||
if (wolf.getTarget() == null || !wolf.getTarget().isValid() || !Wizards.IsAlive(wolf.getTarget())
|
||||
|| wolf.getTarget().getLocation().distance(wolf.getLocation()) > 16)
|
||||
{
|
||||
|
||||
for (Player player : Wizards.GetPlayers(true))
|
||||
{
|
||||
double dist = 0;
|
||||
Player target = null;
|
||||
|
||||
if (!player.equals(wolfOwner))
|
||||
{
|
||||
for (Player player : Wizards.GetPlayers(true))
|
||||
{
|
||||
|
||||
double newDist = player.getLocation().distance(wolf.getLocation());
|
||||
if (!player.equals(wolfOwner))
|
||||
{
|
||||
|
||||
if (newDist < 16 && (target == null || dist > newDist))
|
||||
{
|
||||
dist = newDist;
|
||||
target = player;
|
||||
}
|
||||
}
|
||||
}
|
||||
double newDist = player.getLocation().distance(wolf.getLocation());
|
||||
|
||||
if (target != null)
|
||||
{
|
||||
wolf.setTarget(target);
|
||||
}
|
||||
else
|
||||
{
|
||||
Location loc = ((Player) wolfOwner).getLocation();
|
||||
if (newDist < 16 && (target == null || dist > newDist))
|
||||
{
|
||||
dist = newDist;
|
||||
target = player;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (loc.distance(wolf.getLocation()) > 16)
|
||||
{
|
||||
wolf.teleport(loc);
|
||||
}
|
||||
}
|
||||
if (target != null)
|
||||
{
|
||||
wolf.setTarget(target);
|
||||
}
|
||||
else
|
||||
{
|
||||
Location loc = ((Player) wolfOwner).getLocation();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if (loc.distance(wolf.getLocation()) > 16)
|
||||
{
|
||||
wolf.teleport(loc);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void castSpell(Player player)
|
||||
{
|
||||
castSpell(player, player.getLocation().getBlock().getRelative(BlockFace.DOWN));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void castSpell(Player player)
|
||||
{
|
||||
castSpell(player, player.getLocation().getBlock().getRelative(BlockFace.DOWN));
|
||||
}
|
||||
}
|
||||
|
@ -1,87 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spells.subclasses.TeleportRune;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
public class SpellTeleportRune extends Spell implements SpellClick
|
||||
{
|
||||
private ArrayList<TeleportRune> _teleportRunes = new ArrayList<TeleportRune>();
|
||||
|
||||
@EventHandler
|
||||
public void onTick(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() == UpdateType.TICK)
|
||||
{
|
||||
Iterator<TeleportRune> itel = _teleportRunes.iterator();
|
||||
|
||||
while (itel.hasNext())
|
||||
{
|
||||
TeleportRune rune = itel.next();
|
||||
|
||||
if (rune.tickRune())
|
||||
{
|
||||
itel.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void castSpell(Player player)
|
||||
{
|
||||
Block b = player.getTargetBlock(null, 25 * getSpellLevel(player));
|
||||
|
||||
while (b.getType() != Material.AIR && b.getY() < 250)
|
||||
{
|
||||
b = b.getRelative(BlockFace.UP);
|
||||
}
|
||||
|
||||
if (b.getRelative(BlockFace.DOWN).getType() == Material.AIR)
|
||||
{
|
||||
player.sendMessage(ChatColor.RED + "Unable to place a rune!");
|
||||
return;
|
||||
}
|
||||
|
||||
Location firstTeleport = player.getLocation();
|
||||
|
||||
for (int i = 0; i < 3 && firstTeleport.getBlockY() > 1
|
||||
&& !UtilBlock.solid(firstTeleport.getBlock().getRelative(BlockFace.DOWN)); i++)
|
||||
{
|
||||
firstTeleport.add(0, -1, 0);
|
||||
}
|
||||
|
||||
firstTeleport = firstTeleport.getBlock().getLocation().add(firstTeleport.getX() % 1, 0, firstTeleport.getZ() % 1);
|
||||
|
||||
Location secondTeleport = b.getLocation().add(0.5, 0, 0.5);
|
||||
|
||||
double runeSize = 1.5D * getSpellLevel(player);
|
||||
|
||||
if (firstTeleport.distance(secondTeleport) > runeSize * 2)
|
||||
{
|
||||
TeleportRune teleportRune = new TeleportRune(firstTeleport, secondTeleport, runeSize);
|
||||
|
||||
_teleportRunes.add(teleportRune);
|
||||
|
||||
charge(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendMessage(ChatColor.RED + "Target location too close");
|
||||
}
|
||||
}
|
||||
}
|
@ -6,19 +6,14 @@ import java.util.List;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilShapes;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.explosion.CustomExplosion;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spells.subclasses.TrapRune;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -26,179 +21,52 @@ import org.bukkit.event.EventHandler;
|
||||
|
||||
public class SpellTrapRune extends Spell implements SpellClick
|
||||
{
|
||||
private ArrayList<TrapRune> _runes = new ArrayList<TrapRune>();
|
||||
private ArrayList<TrapRune> _runes = new ArrayList<TrapRune>();
|
||||
|
||||
@EventHandler
|
||||
public void onTick(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() == UpdateType.TICK)
|
||||
{
|
||||
Iterator<TrapRune> itel = _runes.iterator();
|
||||
while (itel.hasNext())
|
||||
{
|
||||
TrapRune rune = itel.next();
|
||||
if (!rune.RuneCaster.isOnline() || UtilPlayer.isSpectator(rune.RuneCaster))
|
||||
{
|
||||
itel.remove();
|
||||
}
|
||||
else if (rune.TicksLived++ > 2000)
|
||||
{
|
||||
itel.remove();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rune.TicksLived <= 100)
|
||||
{
|
||||
if (rune.TicksLived % 15 == 0)
|
||||
initialParticles(rune.RuneLocation, rune.RuneSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!isValid(rune))
|
||||
{
|
||||
trapCard(rune);
|
||||
itel.remove();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Player player : Wizards.GetPlayers(true))
|
||||
{
|
||||
if (isInTrap(rune.RuneLocation, player.getLocation(), rune.RuneSize))
|
||||
{
|
||||
trapCard(rune);
|
||||
itel.remove();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@EventHandler
|
||||
public void onTick(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() == UpdateType.TICK)
|
||||
{
|
||||
Iterator<TrapRune> itel = _runes.iterator();
|
||||
while (itel.hasNext())
|
||||
{
|
||||
TrapRune rune = itel.next();
|
||||
|
||||
public void initialParticles(Location trapLocation, double trapSize)
|
||||
{
|
||||
for (Location loc : getBox(trapLocation, trapSize, 0.3))
|
||||
{
|
||||
for (double y = 0; y < 1; y += 0.2)
|
||||
{
|
||||
trapLocation.getWorld().spigot().playEffect(loc, Effect.FLAME, 0, 0, 0, 0, 0, 0, 1, 30);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (rune.onRuneTick())
|
||||
{
|
||||
itel.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList<Location> getBox(Location trapLocation, double trapSize, double spacing)
|
||||
{
|
||||
ArrayList<Location> boxLocs = getBoxCorners(trapLocation, trapSize);
|
||||
ArrayList<Location> returns = new ArrayList<Location>();
|
||||
@Override
|
||||
public void castSpell(Player p)
|
||||
{
|
||||
List<Block> list = p.getLastTwoTargetBlocks(UtilBlock.blockAirFoliageSet, (getSpellLevel(p) * 4) + 4);
|
||||
|
||||
for (int i = 0; i < boxLocs.size(); i++)
|
||||
{
|
||||
if (list.size() > 1)
|
||||
{
|
||||
Location loc = list.get(0).getLocation().add(0.5, 0, 0.5);
|
||||
|
||||
int a = i + 1 >= boxLocs.size() ? 0 : i + 1;
|
||||
returns.addAll(UtilShapes.getLinesDistancedPoints(boxLocs.get(i), boxLocs.get(a), spacing));
|
||||
returns.add(boxLocs.get(i));
|
||||
if (loc.getBlock().getRelative(BlockFace.DOWN).getType() == Material.AIR)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
return returns;
|
||||
}
|
||||
TrapRune rune = new TrapRune(Wizards, p, loc, getSpellLevel(p));
|
||||
if (!rune.isValid())
|
||||
{
|
||||
p.sendMessage(C.cGreen + "Cannot draw rune on wall");
|
||||
return;
|
||||
}
|
||||
|
||||
private ArrayList<Location> getBoxCorners(Location center, double boxSize)
|
||||
{
|
||||
ArrayList<Location> boxPoints = new ArrayList<Location>();
|
||||
rune.initialParticles();
|
||||
|
||||
boxPoints.add(center.clone().add(-boxSize, 0, -boxSize));
|
||||
boxPoints.add(center.clone().add(boxSize, 0, -boxSize));
|
||||
boxPoints.add(center.clone().add(boxSize, 0, boxSize));
|
||||
boxPoints.add(center.clone().add(-boxSize, 0, boxSize));
|
||||
|
||||
return boxPoints;
|
||||
}
|
||||
|
||||
private boolean isInTrap(Location trapLocation, Location loc, double trapSize)
|
||||
{
|
||||
if (loc.getX() >= trapLocation.getX() - trapSize && loc.getX() <= trapLocation.getX() + trapSize)
|
||||
{
|
||||
if (loc.getZ() >= trapLocation.getZ() - trapSize && loc.getZ() <= trapLocation.getZ() + trapSize)
|
||||
{
|
||||
if (loc.getY() >= trapLocation.getY() - 0.1 && loc.getY() <= trapLocation.getY() + 0.9)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isValid(TrapRune rune)
|
||||
{
|
||||
return !UtilBlock.solid(rune.RuneLocation.getBlock())
|
||||
|| UtilBlock.solid(rune.RuneLocation.getBlock().getRelative(BlockFace.DOWN));
|
||||
/*
|
||||
for (double x = -rune.RuneSize; x <= rune.RuneSize; x++)
|
||||
{
|
||||
for (double z = -rune.RuneSize; z <= rune.RuneSize; z++)
|
||||
{
|
||||
|
||||
Block b = rune.RuneLocation.clone().add(x, 0, z).getBlock();
|
||||
if (UtilBlock.solid(b) || !UtilBlock.solid(b.getRelative(BlockFace.DOWN)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
public void trapCard(TrapRune rune)
|
||||
{
|
||||
rune.RuneLocation.getWorld().playSound(rune.RuneLocation, Sound.WITHER_SHOOT, 5, (float) rune.RuneSize * 2);
|
||||
|
||||
CustomExplosion explosion = new CustomExplosion(Wizards.getArcadeManager().GetDamage(), rune.RuneLocation.clone().add(0,
|
||||
0.3, 0), (float) rune.RuneSize * 1.2F, "Trap Rune");
|
||||
|
||||
explosion.setPlayer(rune.RuneCaster, true);
|
||||
|
||||
explosion.setDropItems(false);
|
||||
|
||||
explosion.explode();
|
||||
|
||||
for (Location loc : getBox(rune.RuneLocation, rune.RuneSize, 0.3))
|
||||
{
|
||||
for (double y = 0; y < 1; y += 0.2)
|
||||
{
|
||||
rune.RuneLocation.getWorld().spigot().playEffect(loc, Effect.FLAME, 0, 0, 0, 0, 0, 0, 1, 30);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void castSpell(Player p)
|
||||
{
|
||||
List<Block> list = p.getLastTwoTargetBlocks(UtilBlock.blockAirFoliageSet, (getSpellLevel(p) * 4) + 4);
|
||||
|
||||
if (list.size() > 1)
|
||||
{
|
||||
Location loc = list.get(0).getLocation().add(0.5, 0, 0.5);
|
||||
|
||||
float trapSize = Math.max(1, getSpellLevel(p) * 0.8F);
|
||||
|
||||
TrapRune rune = new TrapRune();
|
||||
rune.RuneCaster = p;
|
||||
rune.RuneSize = trapSize;
|
||||
rune.RuneLocation = loc;
|
||||
|
||||
if (!isValid(rune))
|
||||
{
|
||||
p.sendMessage(C.cGreen + "Cannot draw rune on wall");
|
||||
return;
|
||||
}
|
||||
|
||||
initialParticles(loc, trapSize);
|
||||
_runes.add(rune);
|
||||
charge(p);
|
||||
}
|
||||
}
|
||||
_runes.add(rune);
|
||||
charge(p);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,170 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.projectile.IThrown;
|
||||
import mineplex.core.projectile.ProjectileUser;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
public class SpellWebShot extends Spell implements SpellClick, IThrown
|
||||
{
|
||||
|
||||
@Override
|
||||
public void castSpell(final Player player)
|
||||
{
|
||||
shoot(player);
|
||||
|
||||
for (int i = 1; i < getSpellLevel(player) * 2; i++)
|
||||
{
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(Wizards.getArcadeManager().getPlugin(), new Runnable()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
shoot(player);
|
||||
}
|
||||
|
||||
}, i * 10);
|
||||
}
|
||||
|
||||
charge(player);
|
||||
}
|
||||
|
||||
private void shoot(Player player)
|
||||
{
|
||||
|
||||
if (Wizards.IsAlive(player))
|
||||
{
|
||||
org.bukkit.entity.Item ent = player.getWorld().dropItem(
|
||||
player.getEyeLocation(),
|
||||
ItemStackFactory.Instance.CreateStack(Material.WEB, (byte) 0, 1,
|
||||
"Web " + player.getName() + " " + System.currentTimeMillis()));
|
||||
|
||||
UtilAction.velocity(ent, player.getLocation().getDirection(), 1.5, false, 0, 0.2, 10, false);
|
||||
Wizards.getArcadeManager().GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 2f);
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.CLICK, 1.2F, 0.8F);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Collide(LivingEntity target, Block block, ProjectileUser data)
|
||||
{
|
||||
if (target != data.GetThrower())
|
||||
{
|
||||
Location loc = data.GetThrown().getLocation();
|
||||
|
||||
if (target != null)
|
||||
{
|
||||
Location l = target.getLocation();
|
||||
|
||||
l.setY(loc.getY());
|
||||
|
||||
if (!UtilBlock.airFoliage(getValidLocation(l)))
|
||||
{
|
||||
l = target.getLocation().add(0, UtilMath.random.nextFloat(), 0);
|
||||
|
||||
if (UtilBlock.airFoliage(getValidLocation(l)))
|
||||
{
|
||||
loc = l;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
loc = l;
|
||||
}
|
||||
|
||||
// Damage Event
|
||||
Wizards.getArcadeManager()
|
||||
.GetDamage()
|
||||
.NewDamageEvent(target, data.GetThrower(), null, DamageCause.PROJECTILE, 2, false, false, false,
|
||||
"Web Shot", "Web Shot");
|
||||
}
|
||||
|
||||
Web(data, loc);
|
||||
}
|
||||
}
|
||||
|
||||
private Block getValidLocation(Location loc)
|
||||
{
|
||||
double[] doubles = new double[]
|
||||
{
|
||||
0, -0.5, 0.5
|
||||
};
|
||||
|
||||
HashMap<Block, Integer> commonBlocks = new HashMap<Block, Integer>();
|
||||
int most = 0;
|
||||
|
||||
for (double x : doubles)
|
||||
{
|
||||
for (double y : doubles)
|
||||
{
|
||||
for (double z : doubles)
|
||||
{
|
||||
Block b = loc.clone().add(x, y, z).getBlock();
|
||||
|
||||
if (UtilBlock.airFoliage(b))
|
||||
{
|
||||
int amount = (commonBlocks.containsKey(b) ? commonBlocks.get(b) : 0) + 1;
|
||||
|
||||
commonBlocks.put(b, amount);
|
||||
|
||||
if (amount > most)
|
||||
{
|
||||
most = amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Entry<Block, Integer> entry : commonBlocks.entrySet())
|
||||
{
|
||||
if (entry.getValue() == most)
|
||||
{
|
||||
return entry.getKey();
|
||||
}
|
||||
}
|
||||
|
||||
return loc.getBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Idle(ProjectileUser data)
|
||||
{
|
||||
Web(data, data.GetThrown().getLocation());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Expire(ProjectileUser data)
|
||||
{
|
||||
Web(data, data.GetThrown().getLocation());
|
||||
}
|
||||
|
||||
public void Web(ProjectileUser data, Location loc)
|
||||
{
|
||||
data.GetThrown().remove();
|
||||
|
||||
Block block = getValidLocation(loc);
|
||||
|
||||
if (UtilBlock.airFoliage(block))
|
||||
block.setType(Material.WEB);
|
||||
}
|
||||
}
|
@ -1,62 +1,128 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilShapes;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.hologram.Hologram;
|
||||
import mineplex.core.hologram.Hologram.HologramTarget;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class SpellWizardsCompass extends Spell implements SpellClick
|
||||
{
|
||||
|
||||
@Override
|
||||
public void castSpell(Player p)
|
||||
{
|
||||
double dist = 9999;
|
||||
Player closestPlayer = null;
|
||||
@Override
|
||||
public void castSpell(Player p)
|
||||
{
|
||||
Location loc = p.getEyeLocation().subtract(0, 1, 0);
|
||||
|
||||
for (Player player : Wizards.GetPlayers(true))
|
||||
{
|
||||
double newDist = player.getLocation().distance(p.getLocation());
|
||||
final ArrayList<Integer[]> colors = new ArrayList<Integer[]>();
|
||||
|
||||
if (newDist > 10 && (closestPlayer == null || newDist < dist))
|
||||
{
|
||||
for (int x = -1; x <= 1; x++)
|
||||
{
|
||||
|
||||
closestPlayer = player;
|
||||
dist = newDist;
|
||||
for (int y = -1; y <= 1; y++)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
for (int z = -1; z <= 1; z++)
|
||||
{
|
||||
colors.add(new Integer[]
|
||||
{
|
||||
x, y, z
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (closestPlayer != null)
|
||||
{
|
||||
int particlesPlayed = 0;
|
||||
Collections.shuffle(colors);
|
||||
|
||||
for (Location loc : UtilShapes.getLinesDistancedPoints(
|
||||
p.getEyeLocation().subtract(p.getEyeLocation().getDirection().normalize().multiply(-0.3)).subtract(0, .5, 0),
|
||||
closestPlayer.getEyeLocation(), 0.3))
|
||||
{
|
||||
for (Player enemy : Wizards.GetPlayers(true))
|
||||
{
|
||||
if (enemy == p)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (particlesPlayed++ > 13)
|
||||
{
|
||||
break;
|
||||
}
|
||||
final double playerDist = Math.min(7, UtilMath.offset(enemy, p));
|
||||
|
||||
loc.getWorld().spigot().playEffect(loc, Effect.HAPPY_VILLAGER, 0, 0, 0.1F, 0.1F, 0.1F, 0, 4, 25);
|
||||
final Vector traj = UtilAlg.getTrajectory(p.getLocation(), enemy.getEyeLocation()).multiply(0.1);
|
||||
|
||||
}
|
||||
final Hologram hologram = new Hologram(Wizards.getArcadeManager().getHologramManager(), loc.clone().add(0, 0.3, 0)
|
||||
.add(traj.clone().normalize().multiply(playerDist)), enemy.getName());
|
||||
|
||||
charge(p);
|
||||
}
|
||||
else
|
||||
{
|
||||
hologram.setHologramTarget(HologramTarget.WHITELIST);
|
||||
hologram.addPlayer(p);
|
||||
|
||||
p.sendMessage(C.cRed + "All players are less than 10 blocks from you!");
|
||||
hologram.start();
|
||||
|
||||
}
|
||||
final Location location = loc.clone();
|
||||
final Integer[] ints = colors.remove(0);
|
||||
|
||||
}
|
||||
new BukkitRunnable()
|
||||
{
|
||||
int dist;
|
||||
int tick;
|
||||
HashMap<Location, Integer> locations = new HashMap<Location, Integer>();
|
||||
|
||||
public void run()
|
||||
{
|
||||
tick++;
|
||||
|
||||
Iterator<Entry<Location, Integer>> itel = locations.entrySet().iterator();
|
||||
|
||||
while (itel.hasNext())
|
||||
{
|
||||
Entry<Location, Integer> entry = itel.next();
|
||||
|
||||
if ((entry.getValue() + tick) % 3 == 0)
|
||||
{
|
||||
// Colored redstone dust
|
||||
UtilParticle.PlayParticle(ParticleType.RED_DUST, entry.getKey(), ints[0], ints[1], ints[2], 1, 0);
|
||||
}
|
||||
|
||||
if (entry.getValue() < tick)
|
||||
{
|
||||
itel.remove();
|
||||
}
|
||||
}
|
||||
|
||||
if (dist <= playerDist * 10)
|
||||
{
|
||||
for (int a = 0; a < 2; a++)
|
||||
{
|
||||
// Colored redstone dust
|
||||
UtilParticle.PlayParticle(ParticleType.RED_DUST, location, ints[0], ints[1], ints[2], 1, 0);
|
||||
|
||||
locations.put(location.clone(), tick + 50);
|
||||
|
||||
location.add(traj);
|
||||
dist++;
|
||||
}
|
||||
}
|
||||
else if (locations.isEmpty())
|
||||
{
|
||||
hologram.stop();
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(Wizards.getArcadeManager().getPlugin(), 0, 0);
|
||||
}
|
||||
|
||||
p.playSound(p.getLocation(), Sound.ZOMBIE_UNFECT, 1.5F, 1);
|
||||
|
||||
charge(p);
|
||||
}
|
||||
}
|
||||
|
@ -1,62 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells.subclasses;
|
||||
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilShapes;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.minecraft.game.core.damage.DamageManager;
|
||||
import mineplex.minecraft.game.core.explosion.CustomExplosion;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class ExplosiveRune
|
||||
{
|
||||
private Location _explosiveLocation;
|
||||
private Player _explosiveOwner;
|
||||
private float _explosiveSize;
|
||||
private int _ticksTillExplode = 60;
|
||||
private DamageManager _damageManager;
|
||||
|
||||
public boolean onTick()
|
||||
{
|
||||
_ticksTillExplode--;
|
||||
|
||||
if (_ticksTillExplode <= 0)
|
||||
{
|
||||
CustomExplosion explosion = new CustomExplosion(_damageManager, _explosiveLocation, _explosiveSize, "Explosive Rune");
|
||||
|
||||
explosion.setPlayer(_explosiveOwner, true);
|
||||
|
||||
explosion.setDropItems(false);
|
||||
|
||||
explosion.explode();
|
||||
|
||||
drawBoxParticles();
|
||||
return true;
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public ExplosiveRune(DamageManager damageManager, Location loc, Player player, float size)
|
||||
{
|
||||
_explosiveLocation = loc;
|
||||
_explosiveOwner = player;
|
||||
_explosiveSize = size;
|
||||
_damageManager = damageManager;
|
||||
drawBoxParticles();
|
||||
}
|
||||
|
||||
public Location getLocation()
|
||||
{
|
||||
return _explosiveLocation;
|
||||
}
|
||||
|
||||
private void drawBoxParticles()
|
||||
{
|
||||
for (Location loc : UtilShapes.getDistancedCircle(_explosiveLocation, 0.3, _explosiveSize * 1.3D))
|
||||
{
|
||||
UtilParticle.PlayParticle(ParticleType.FLAME, loc, 0, 0, 0, 0, 1);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,84 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells.subclasses;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilShapes;
|
||||
import nautilus.game.arcade.game.games.wizards.Wizards;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
public class HealingRune
|
||||
{
|
||||
private Location _location;
|
||||
private int _ticksToLive;
|
||||
private double _runeSize;
|
||||
private Wizards _wizards;
|
||||
|
||||
public HealingRune(Wizards wizards, Location location, int spellLevel)
|
||||
{
|
||||
_location = location;
|
||||
_ticksToLive = 100 + (spellLevel * 60);
|
||||
_runeSize = 2 + (spellLevel * .5D);
|
||||
_wizards = wizards;
|
||||
}
|
||||
|
||||
public boolean onTick()
|
||||
{
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (player.getGameMode() == GameMode.CREATIVE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Location loc = player.getLocation().clone();
|
||||
|
||||
if (loc.getY() >= _location.getY() && loc.getY() <= _location.getY() + 2)
|
||||
{
|
||||
loc.setY(_location.getY());
|
||||
|
||||
if (loc.distance(_location) <= _runeSize)
|
||||
{
|
||||
_wizards.getArcadeManager().GetCondition().Factory().Regen("Healing Rune", player, null, 50, 0, false, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double currentY = 0;
|
||||
ArrayList<Location> locs = UtilShapes.getDistancedCircle(_location, 0.2D, _runeSize);
|
||||
double addY = 1.5D / locs.size();
|
||||
|
||||
int a = UtilMath.r(locs.size());
|
||||
for (int b = 0; b < 2; b++)
|
||||
{
|
||||
for (int i = 0; i < locs.size(); i++)
|
||||
{
|
||||
a++;
|
||||
|
||||
if (i % 30 == _ticksToLive % 30)
|
||||
{
|
||||
Location loc = locs.get(a % locs.size());
|
||||
|
||||
UtilParticle.PlayParticle(ParticleType.HEART, loc.clone().add(0, currentY, 0), 0, 0, 0, 0, 1);
|
||||
}
|
||||
|
||||
currentY += addY;
|
||||
}
|
||||
}
|
||||
|
||||
if (_ticksToLive-- <= 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
@ -1,112 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells.subclasses;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilShapes;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import nautilus.game.arcade.game.games.wizards.Wizards;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class LaunchRune
|
||||
{
|
||||
private Player _caster;
|
||||
private Wizards _wizards;
|
||||
private Location _runeLocation;
|
||||
private float _runeSize;
|
||||
private int _ticksTillActive = 60;
|
||||
private int _spellLevel;
|
||||
private HashMap<UUID, Long> _launchedEntities = new HashMap<UUID, Long>();
|
||||
|
||||
public boolean onTick()
|
||||
{
|
||||
_ticksTillActive--;
|
||||
boolean launched = false;
|
||||
|
||||
if (_ticksTillActive <= 0)
|
||||
{
|
||||
for (LivingEntity entity : _runeLocation.getWorld().getEntitiesByClass(LivingEntity.class))
|
||||
{
|
||||
|
||||
if (!(entity instanceof Player) || !UtilPlayer.isSpectator(entity))
|
||||
{
|
||||
|
||||
UUID uuid = entity.getUniqueId();
|
||||
|
||||
if (!_launchedEntities.containsKey(uuid) || _launchedEntities.get(uuid) < System.currentTimeMillis())
|
||||
{
|
||||
|
||||
Location loc = entity.getLocation();
|
||||
|
||||
if (loc.getY() >= _runeLocation.getY() - 0.1 && loc.getY() <= _runeLocation.getY() + 1.3)
|
||||
{
|
||||
|
||||
loc.setY(_runeLocation.getY());
|
||||
|
||||
if (loc.distance(_runeLocation) <= _runeSize)
|
||||
{
|
||||
_wizards.getArcadeManager().GetCondition().Factory()
|
||||
.Falling("Launch Rune", entity, _caster, 10, false, false);
|
||||
|
||||
Vector vector = entity.getLocation().getDirection().normalize().multiply(0.1);
|
||||
vector.setY(1F + (_spellLevel * 0.15F));
|
||||
entity.setVelocity(vector);
|
||||
entity.setFallDistance(-_spellLevel * 1.5F);
|
||||
|
||||
launched = true;
|
||||
|
||||
_launchedEntities.put(uuid, System.currentTimeMillis() + (long) (_runeSize * 2500L));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (launched)
|
||||
{
|
||||
_runeLocation.getWorld().playSound(_runeLocation, Sound.BAT_TAKEOFF, 1.2F, 1F);
|
||||
displayCircle(5);
|
||||
}
|
||||
else if (_ticksTillActive % (_ticksTillActive >= 0 ? 20 : 7) == 0)
|
||||
{
|
||||
displayCircle(1);
|
||||
}
|
||||
|
||||
return _ticksTillActive < -60 * 20;
|
||||
}
|
||||
|
||||
private void displayCircle(int loops)
|
||||
{
|
||||
for (double y = 0; y < loops * 0.2D; y += 0.2D)
|
||||
{
|
||||
for (Location loc : UtilShapes.getDistancedCircle(_runeLocation, 0.3D, _runeSize))
|
||||
{
|
||||
UtilParticle.PlayParticle(ParticleType.CLOUD, loc, 0, 0, 0, 0, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public LaunchRune(Wizards wizards, Player caster, Location loc, float size, int spellLevel)
|
||||
{
|
||||
_wizards = wizards;
|
||||
_caster = caster;
|
||||
_runeLocation = loc;
|
||||
_runeSize = size;
|
||||
_spellLevel = spellLevel;
|
||||
displayCircle(1);
|
||||
}
|
||||
|
||||
public Location getLocation()
|
||||
{
|
||||
return _runeLocation;
|
||||
}
|
||||
}
|
@ -1,118 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells.subclasses;
|
||||
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilShapes;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class TeleportRune
|
||||
{
|
||||
private Location _firstLoc, _secondLoc;
|
||||
private int _ticksLived = -60;
|
||||
private double _runeSize;
|
||||
|
||||
public TeleportRune(Location firstLocation, Location secondLocation, double runeSize)
|
||||
{
|
||||
_firstLoc = firstLocation;
|
||||
_secondLoc = secondLocation;
|
||||
_runeSize = runeSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true on remove
|
||||
*/
|
||||
public boolean tickRune()
|
||||
{
|
||||
if (_ticksLived >= 150)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_ticksLived % 5 == 0)
|
||||
{
|
||||
resendRunes();
|
||||
}
|
||||
|
||||
if (_ticksLived >= 0)
|
||||
{
|
||||
if (_ticksLived % 40 == 0)
|
||||
{
|
||||
_firstLoc.getWorld().playSound(_firstLoc, Sound.PORTAL, 1.5F, 0F);
|
||||
_firstLoc.getWorld().playSound(_secondLoc, Sound.PORTAL, 1.5F, 0F);
|
||||
}
|
||||
|
||||
for (LivingEntity entity : _firstLoc.getWorld().getEntitiesByClass(LivingEntity.class))
|
||||
{
|
||||
if (entity instanceof Player && UtilPlayer.isSpectator(entity))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Location loc = entity.getLocation();
|
||||
|
||||
if (loc.distance(_firstLoc) <= _runeSize && loc.getBlockY() >= _firstLoc.getBlockY()
|
||||
&& loc.getBlockY() <= _firstLoc.getBlockY() + 2)
|
||||
{
|
||||
|
||||
for (double y = 0; y < 2; y += 0.5)
|
||||
{
|
||||
UtilParticle.PlayParticle(ParticleType.PORTAL, _secondLoc.clone().add(0, y, 0), 1.5F, 1.5F, 1.5F, 0F, 40);
|
||||
}
|
||||
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, _secondLoc.clone().add(0, 1, 0), 0, 0, 0, 0, 5);
|
||||
|
||||
_secondLoc.getWorld().playSound(_secondLoc, Sound.ENDERMAN_TELEPORT, 3, 0);
|
||||
|
||||
Location newLoc = _secondLoc.clone();
|
||||
newLoc.setDirection(entity.getEyeLocation().getDirection());
|
||||
entity.setFallDistance(0F);
|
||||
|
||||
entity.teleport(newLoc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_ticksLived++;
|
||||
return false;
|
||||
}
|
||||
|
||||
private void makeCircle(Location loc, double distance)
|
||||
{
|
||||
for (Location l : UtilShapes.getPointsInCircle(loc, (int) Math.ceil(Math.PI * distance * 2), distance))
|
||||
{
|
||||
UtilParticle.PlayParticle(_ticksLived >= 0 ? ParticleType.FIREWORKS_SPARK : ParticleType.RED_DUST, l, 0, 0, 0, 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
private void redrawRunes(Location runeLoc)
|
||||
{
|
||||
runeLoc = runeLoc.clone();
|
||||
if (_ticksLived >= 0)
|
||||
{
|
||||
for (double y = 0; y < 1; y += 0.4)
|
||||
{
|
||||
runeLoc.add(0, y, 0);
|
||||
makeCircle(runeLoc, _runeSize);
|
||||
makeCircle(runeLoc, (_runeSize / 3) * 2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
makeCircle(runeLoc, _runeSize);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resending runes resends the particles.
|
||||
*/
|
||||
public void resendRunes()
|
||||
{
|
||||
redrawRunes(_firstLoc);
|
||||
redrawRunes(_secondLoc);
|
||||
}
|
||||
}
|
@ -1,15 +1,188 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells.subclasses;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilShapes;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.minecraft.game.core.explosion.CustomExplosion;
|
||||
import nautilus.game.arcade.game.games.wizards.Wizards;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class TrapRune
|
||||
{
|
||||
// TODO Methods and potentially move code into here
|
||||
|
||||
public Location RuneLocation;
|
||||
public float RuneSize;
|
||||
public Player RuneCaster;
|
||||
public int TicksLived;
|
||||
private Location _runeLocation;
|
||||
private float _runeSize;
|
||||
private Player _runeCaster;
|
||||
private int _ticksLived;
|
||||
private Wizards _wizards;
|
||||
private int _spellLevel;
|
||||
|
||||
public boolean onRuneTick()
|
||||
{
|
||||
|
||||
if (!_runeCaster.isOnline() || UtilPlayer.isSpectator(_runeCaster))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (_ticksLived++ > 2000)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_ticksLived <= 100)
|
||||
{
|
||||
if (_ticksLived % 15 == 0)
|
||||
{
|
||||
initialParticles();
|
||||
}
|
||||
|
||||
if (_ticksLived == 100)
|
||||
{
|
||||
UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, _runeLocation, 0, _runeSize / 4, 0, _runeSize / 4,
|
||||
(int) (_runeSize * 10));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!isValid())
|
||||
{
|
||||
trapCard();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Player player : _wizards.GetPlayers(true))
|
||||
{
|
||||
if (isInTrap(player.getLocation()))
|
||||
{
|
||||
trapCard();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public TrapRune(Wizards wizards, Player player, Location location, int spellLevel)
|
||||
{
|
||||
_wizards = wizards;
|
||||
_runeCaster = player;
|
||||
_runeLocation = location;
|
||||
_spellLevel = spellLevel;
|
||||
_runeSize = Math.max(1, spellLevel * 0.8F);
|
||||
}
|
||||
|
||||
public void initialParticles()
|
||||
{
|
||||
for (Location loc : getBox(0.3))
|
||||
{
|
||||
for (double y = 0; y < 1; y += 0.2)
|
||||
{
|
||||
_runeLocation.getWorld().spigot().playEffect(loc, Effect.SMALL_SMOKE, 0, 0, 0, 0, 0, 0, 1, 30);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<Location> getBox(double spacing)
|
||||
{
|
||||
ArrayList<Location> boxLocs = getBoxCorners();
|
||||
ArrayList<Location> returns = new ArrayList<Location>();
|
||||
|
||||
for (int i = 0; i < boxLocs.size(); i++)
|
||||
{
|
||||
|
||||
int a = i + 1 >= boxLocs.size() ? 0 : i + 1;
|
||||
returns.addAll(UtilShapes.getLinesDistancedPoints(boxLocs.get(i), boxLocs.get(a), spacing));
|
||||
returns.add(boxLocs.get(i));
|
||||
|
||||
}
|
||||
return returns;
|
||||
}
|
||||
|
||||
public ArrayList<Location> getBoxCorners()
|
||||
{
|
||||
ArrayList<Location> boxPoints = new ArrayList<Location>();
|
||||
|
||||
boxPoints.add(_runeLocation.clone().add(-_runeSize, 0, -_runeSize));
|
||||
boxPoints.add(_runeLocation.clone().add(_runeSize, 0, -_runeSize));
|
||||
boxPoints.add(_runeLocation.clone().add(_runeSize, 0, _runeSize));
|
||||
boxPoints.add(_runeLocation.clone().add(-_runeSize, 0, _runeSize));
|
||||
|
||||
return boxPoints;
|
||||
}
|
||||
|
||||
public boolean isInTrap(Location loc)
|
||||
{
|
||||
if (loc.getX() >= _runeLocation.getX() - _runeSize && loc.getX() <= _runeLocation.getX() + _runeSize)
|
||||
{
|
||||
if (loc.getZ() >= _runeLocation.getZ() - _runeSize && loc.getZ() <= _runeLocation.getZ() + _runeSize)
|
||||
{
|
||||
if (loc.getY() >= _runeLocation.getY() - 0.1 && loc.getY() <= _runeLocation.getY() + 0.9)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isValid()
|
||||
{
|
||||
return !UtilBlock.solid(_runeLocation.getBlock())
|
||||
|| UtilBlock.solid(_runeLocation.getBlock().getRelative(BlockFace.DOWN));
|
||||
/*
|
||||
for (double x = -RuneSize; x <= RuneSize; x++)
|
||||
{
|
||||
for (double z = -RuneSize; z <= RuneSize; z++)
|
||||
{
|
||||
|
||||
Block b = RuneLocation.clone().add(x, 0, z).getBlock();
|
||||
if (UtilBlock.solid(b) || !UtilBlock.solid(b.getRelative(BlockFace.DOWN)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
public void trapCard()
|
||||
{
|
||||
_runeLocation.getWorld().playSound(_runeLocation, Sound.WITHER_SHOOT, 5, (float) _runeSize * 2);
|
||||
|
||||
CustomExplosion explosion = new CustomExplosion(_wizards.getArcadeManager().GetDamage(), _wizards.getArcadeManager()
|
||||
.GetExplosion(), _runeLocation.clone().add(0, 0.3, 0), (float) _runeSize * 1.2F, "Trap Rune");
|
||||
|
||||
explosion.setPlayer(_runeCaster, true);
|
||||
|
||||
explosion.setBlockExplosionSize((float) _runeSize * 2F);
|
||||
|
||||
explosion.setFallingBlockExplosion(true);
|
||||
|
||||
explosion.setDropItems(false);
|
||||
|
||||
explosion.setMaxDamage((_spellLevel * 4) + 6);
|
||||
|
||||
explosion.explode();
|
||||
|
||||
for (Location loc : getBox(0.3))
|
||||
{
|
||||
for (double y = 0; y < 1; y += 0.2)
|
||||
{
|
||||
_runeLocation.getWorld().spigot().playEffect(loc, Effect.SMOKE, 0, 0, 0, 0, 0, 0, 1, 30);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import java.util.ArrayList;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
@ -76,10 +77,10 @@ public class IcePathData
|
||||
|
||||
loc.add(dir.clone().multiply(0.2));
|
||||
|
||||
if (loc.getBlock().getTypeId() == 79)
|
||||
if (loc.getBlock().getType() == Material.ICE)
|
||||
continue;
|
||||
|
||||
if (loc.getBlock().getTypeId() == 0 || loc.getBlock().getTypeId() == 78)
|
||||
if (loc.getBlock().getType() == Material.AIR || loc.getBlock().getType() == Material.SNOW)
|
||||
{
|
||||
if (!_blocks.contains(loc.getBlock()))
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ public class GameGemManager implements Listener
|
||||
{
|
||||
ArcadeManager Manager;
|
||||
|
||||
boolean DoubleGem = true;
|
||||
boolean DoubleGem = false;
|
||||
|
||||
public GameGemManager(ArcadeManager manager)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user