Wizards progress
This commit is contained in:
parent
52d83587cd
commit
dd2418232c
@ -44,7 +44,7 @@ public class UtilPlayer
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private static class Vector3D
|
||||
{
|
||||
|
||||
@ -88,7 +88,7 @@ public class UtilPlayer
|
||||
{
|
||||
if (other == null)
|
||||
throw new IllegalArgumentException("other cannot be NULL");
|
||||
|
||||
|
||||
return new Vector3D(x + other.x, y + other.y, z + other.z);
|
||||
}
|
||||
|
||||
@ -109,7 +109,7 @@ public class UtilPlayer
|
||||
return new Vector3D(x - other.x, y - other.y, z - other.z);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static Player getPlayerInSight(Player p, int range, boolean lineOfSight)
|
||||
{
|
||||
Location observerPos = p.getEyeLocation();
|
||||
@ -124,14 +124,14 @@ public class UtilPlayer
|
||||
|
||||
if (entity == p || (entity instanceof Player && ((Player) entity).getGameMode() == GameMode.CREATIVE))
|
||||
continue;
|
||||
|
||||
|
||||
double theirDist = p.getEyeLocation().distance(entity.getLocation());
|
||||
|
||||
|
||||
if (lineOfSight
|
||||
&& p.getLastTwoTargetBlocks(UtilBlock.blockAirFoliageSet, (int) Math.ceil(theirDist)).get(0).getLocation()
|
||||
.distance(p.getEyeLocation()) + 1 < theirDist)
|
||||
continue;
|
||||
|
||||
|
||||
Vector3D targetPos = new Vector3D(entity.getLocation());
|
||||
Vector3D minimum = targetPos.add(-0.5, 0, -0.5);
|
||||
Vector3D maximum = targetPos.add(0.5, 1.67, 0.5);
|
||||
@ -152,7 +152,7 @@ public class UtilPlayer
|
||||
* AviodAllies doesn't work. Leaving as a param as it sounds like something you may want in the future.
|
||||
*/
|
||||
public static Entity getEntityInSight(Player player, int rangeToScan, boolean avoidAllies, boolean avoidNonLiving,
|
||||
boolean lineOfSight)
|
||||
boolean lineOfSight, float expandBoxesPercentage)
|
||||
{
|
||||
Location observerPos = player.getEyeLocation();
|
||||
Vector3D observerDir = new Vector3D(observerPos.getDirection());
|
||||
@ -165,20 +165,22 @@ public class UtilPlayer
|
||||
{
|
||||
if (entity == player || (entity instanceof Player && ((Player) entity).getGameMode() == GameMode.CREATIVE))
|
||||
continue;
|
||||
|
||||
|
||||
if (avoidNonLiving && !(entity instanceof LivingEntity))
|
||||
continue;
|
||||
|
||||
|
||||
double theirDist = player.getEyeLocation().distance(entity.getLocation());
|
||||
if (lineOfSight
|
||||
&& player.getLastTwoTargetBlocks(UtilBlock.blockAirFoliageSet, (int) Math.ceil(theirDist)).get(0).getLocation()
|
||||
.distance(player.getEyeLocation()) + 1 < theirDist)
|
||||
&& player.getLastTwoTargetBlocks(UtilBlock.blockAirFoliageSet, (int) Math.ceil(theirDist)).get(0)
|
||||
.getLocation().distance(player.getEyeLocation()) + 1 < theirDist)
|
||||
continue;
|
||||
|
||||
|
||||
Vector3D targetPos = new Vector3D(entity.getLocation());
|
||||
float width = ((CraftEntity) entity).getHandle().width / 1.7F;
|
||||
Vector3D minimum = targetPos.add(-width, -0.1, -width);
|
||||
Vector3D maximum = targetPos.add(width, ((CraftEntity) entity).getHandle().length * 1.1, width);
|
||||
|
||||
float width = (((CraftEntity) entity).getHandle().width / 1.8F) * expandBoxesPercentage;
|
||||
|
||||
Vector3D minimum = targetPos.add(-width, -0.1 / expandBoxesPercentage, -width);
|
||||
Vector3D maximum = targetPos.add(width, ((CraftEntity) entity).getHandle().length * expandBoxesPercentage, width);
|
||||
|
||||
if (hasIntersection(observerStart, observerEnd, minimum, maximum))
|
||||
{
|
||||
@ -191,403 +193,386 @@ public class UtilPlayer
|
||||
}
|
||||
return hit;
|
||||
}
|
||||
|
||||
public static void message(Entity client, LinkedList<String> messageList)
|
||||
{
|
||||
message(client, messageList, false);
|
||||
}
|
||||
|
||||
public static void message(Entity client, String message)
|
||||
{
|
||||
message(client, message, false);
|
||||
}
|
||||
|
||||
public static void message(Entity client, LinkedList<String> messageList, boolean wiki)
|
||||
{
|
||||
for (String curMessage : messageList)
|
||||
{
|
||||
message(client, curMessage, wiki);
|
||||
}
|
||||
}
|
||||
|
||||
public static void message(Entity client, String message, boolean wiki)
|
||||
{
|
||||
if (client == null)
|
||||
return;
|
||||
|
||||
if (!(client instanceof Player))
|
||||
return;
|
||||
|
||||
/*
|
||||
if (wiki)
|
||||
message = UtilWiki.link(message);
|
||||
*/
|
||||
|
||||
((Player)client).sendMessage(message);
|
||||
}
|
||||
|
||||
public static Player searchExact(String name)
|
||||
{
|
||||
for (Player cur : UtilServer.getPlayers())
|
||||
if (cur.getName().equalsIgnoreCase(name))
|
||||
return cur;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Player searchExact(UUID uuid)
|
||||
{
|
||||
return UtilServer.getServer().getPlayer(uuid);
|
||||
}
|
||||
|
||||
public static String searchCollection(Player caller, String player, Collection<String> coll, String collName, boolean inform)
|
||||
{
|
||||
LinkedList<String> matchList = new LinkedList<String>();
|
||||
|
||||
for (String cur : coll)
|
||||
{
|
||||
if (cur.equalsIgnoreCase(player))
|
||||
return cur;
|
||||
|
||||
if (cur.toLowerCase().contains(player.toLowerCase()))
|
||||
matchList.add(cur);
|
||||
}
|
||||
|
||||
//No / Non-Unique
|
||||
if (matchList.size() != 1)
|
||||
{
|
||||
if (!inform)
|
||||
return null;
|
||||
|
||||
//Inform
|
||||
message(caller, F.main(collName + " Search", "" +
|
||||
C.mCount + matchList.size() +
|
||||
C.mBody + " matches for [" +
|
||||
C.mElem + player +
|
||||
C.mBody + "]."));
|
||||
|
||||
if (matchList.size() > 0)
|
||||
{
|
||||
String matchString = "";
|
||||
for (String cur : matchList)
|
||||
matchString += cur + " ";
|
||||
|
||||
message(caller, F.main(collName + " Search", "" +
|
||||
C.mBody + " Matches [" +
|
||||
C.mElem + matchString +
|
||||
C.mBody + "]."));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return matchList.get(0);
|
||||
}
|
||||
|
||||
public static Player searchOnline(Player caller, String player, boolean inform)
|
||||
{
|
||||
LinkedList<Player> matchList = new LinkedList<Player>();
|
||||
|
||||
for (Player cur : UtilServer.getPlayers())
|
||||
{
|
||||
if (cur.getName().equalsIgnoreCase(player))
|
||||
return cur;
|
||||
|
||||
if (cur.getName().toLowerCase().contains(player.toLowerCase()))
|
||||
matchList.add(cur);
|
||||
}
|
||||
|
||||
//No / Non-Unique
|
||||
if (matchList.size() != 1)
|
||||
{
|
||||
if (!inform)
|
||||
return null;
|
||||
|
||||
//Inform
|
||||
message(caller, F.main("Online Player Search", "" +
|
||||
C.mCount + matchList.size() +
|
||||
C.mBody + " matches for [" +
|
||||
C.mElem + player +
|
||||
C.mBody + "]."));
|
||||
|
||||
if (matchList.size() > 0)
|
||||
{
|
||||
String matchString = "";
|
||||
for (Player cur : matchList)
|
||||
matchString += F.elem(cur.getName()) + ", ";
|
||||
if (matchString.length() > 1)
|
||||
matchString = matchString.substring(0 , matchString.length() - 2);
|
||||
|
||||
message(caller, F.main("Online Player Search", "" +
|
||||
C.mBody + "Matches [" +
|
||||
C.mElem + matchString +
|
||||
C.mBody + "]."));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return matchList.get(0);
|
||||
}
|
||||
|
||||
public static void searchOffline(List<String> matches, final Callback<String> callback, final Player caller, final String player, final boolean inform)
|
||||
{
|
||||
//No / Non-Unique
|
||||
if (matches.size() != 1)
|
||||
{
|
||||
if (!inform || !caller.isOnline())
|
||||
{
|
||||
callback.run(null);
|
||||
return;
|
||||
}
|
||||
|
||||
//Inform
|
||||
message(caller, F.main("Offline Player Search", "" +
|
||||
C.mCount + matches.size() +
|
||||
C.mBody + " matches for [" +
|
||||
C.mElem + player +
|
||||
C.mBody + "]."));
|
||||
|
||||
if (matches.size() > 0)
|
||||
{
|
||||
String matchString = "";
|
||||
for (String cur : matches)
|
||||
matchString += cur + " ";
|
||||
if (matchString.length() > 1)
|
||||
matchString = matchString.substring(0 , matchString.length() - 1);
|
||||
|
||||
message(caller, F.main("Offline Player Search", "" +
|
||||
C.mBody + "Matches [" +
|
||||
C.mElem + matchString +
|
||||
C.mBody + "]."));
|
||||
}
|
||||
|
||||
callback.run(null);
|
||||
return;
|
||||
}
|
||||
|
||||
callback.run(matches.get(0));
|
||||
}
|
||||
|
||||
public static LinkedList<Player> matchOnline(Player caller, String players, boolean inform)
|
||||
{
|
||||
LinkedList<Player> matchList = new LinkedList<Player>();
|
||||
|
||||
String failList = "";
|
||||
|
||||
for (String cur : players.split(","))
|
||||
{
|
||||
Player match = searchOnline(caller, cur, inform);
|
||||
|
||||
if (match != null)
|
||||
matchList.add(match);
|
||||
|
||||
else
|
||||
failList += cur + " " ;
|
||||
}
|
||||
|
||||
if (inform && failList.length() > 0)
|
||||
{
|
||||
failList = failList.substring(0, failList.length() - 1);
|
||||
message(caller, F.main("Online Player(s) Search", "" +
|
||||
C.mBody + "Invalid [" +
|
||||
C.mElem + failList +
|
||||
C.mBody + "]."));
|
||||
}
|
||||
|
||||
return matchList;
|
||||
}
|
||||
|
||||
public static LinkedList<Player> getNearby(Location loc, double maxDist)
|
||||
{
|
||||
LinkedList<Player> nearbyMap = new LinkedList<Player>();
|
||||
|
||||
for (Player cur : loc.getWorld().getPlayers())
|
||||
{
|
||||
if (cur.getGameMode() == GameMode.CREATIVE)
|
||||
continue;
|
||||
|
||||
if (cur.isDead())
|
||||
continue;
|
||||
|
||||
double dist = loc.toVector().subtract(cur.getLocation().toVector()).length();
|
||||
|
||||
if (dist > maxDist)
|
||||
continue;
|
||||
|
||||
for (int i=0 ; i<nearbyMap.size() ; i++)
|
||||
{
|
||||
if (dist < loc.toVector().subtract(nearbyMap.get(i).getLocation().toVector()).length())
|
||||
{
|
||||
nearbyMap.add(i, cur);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!nearbyMap.contains(cur))
|
||||
nearbyMap.addLast(cur);
|
||||
}
|
||||
|
||||
return nearbyMap;
|
||||
}
|
||||
|
||||
public static Player getClosest(Location loc, Collection<Player> ignore)
|
||||
{
|
||||
Player best = null;
|
||||
double bestDist = 0;
|
||||
|
||||
for (Player cur : loc.getWorld().getPlayers())
|
||||
{
|
||||
if (cur.getGameMode() == GameMode.CREATIVE)
|
||||
continue;
|
||||
|
||||
if (cur.isDead())
|
||||
continue;
|
||||
|
||||
if (ignore != null && ignore.contains(cur))
|
||||
continue;
|
||||
|
||||
double dist = UtilMath.offset(cur.getLocation(), loc);
|
||||
|
||||
if (best == null || dist < bestDist)
|
||||
{
|
||||
best = cur;
|
||||
bestDist = dist;
|
||||
}
|
||||
}
|
||||
|
||||
return best;
|
||||
}
|
||||
|
||||
public static Player getClosest(Location loc, Entity ignore)
|
||||
{
|
||||
Player best = null;
|
||||
double bestDist = 0;
|
||||
|
||||
for (Player cur : loc.getWorld().getPlayers())
|
||||
{
|
||||
if (cur.getGameMode() == GameMode.CREATIVE)
|
||||
continue;
|
||||
|
||||
if (cur.isDead())
|
||||
continue;
|
||||
|
||||
if (ignore != null && ignore.equals(cur))
|
||||
continue;
|
||||
|
||||
double dist = UtilMath.offset(cur.getLocation(), loc);
|
||||
|
||||
if (best == null || dist < bestDist)
|
||||
{
|
||||
best = cur;
|
||||
bestDist = dist;
|
||||
}
|
||||
}
|
||||
|
||||
return best;
|
||||
}
|
||||
|
||||
public static void kick(Player player, String module, String message)
|
||||
{
|
||||
kick(player,module,message, true);
|
||||
}
|
||||
|
||||
public static void kick(Player player, String module, String message, boolean log)
|
||||
{
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
String out = ChatColor.RED + module +
|
||||
ChatColor.WHITE + " - " +
|
||||
ChatColor.YELLOW + message;
|
||||
player.kickPlayer(out);
|
||||
|
||||
//Log
|
||||
if (log)
|
||||
System.out.println("Kicked Client [" + player.getName() + "] for [" + module + " - " + message + "]");
|
||||
}
|
||||
|
||||
public static HashMap<Player, Double> getInRadius(Location loc, double dR)
|
||||
{
|
||||
HashMap<Player, Double> players = new HashMap<Player, Double>();
|
||||
|
||||
for (Player cur : loc.getWorld().getPlayers())
|
||||
{
|
||||
if (cur.getGameMode() == GameMode.CREATIVE)
|
||||
continue;
|
||||
|
||||
double offset = UtilMath.offset(loc, cur.getLocation());
|
||||
|
||||
if (offset < dR)
|
||||
players.put(cur, 1 - (offset/dR));
|
||||
}
|
||||
|
||||
return players;
|
||||
}
|
||||
|
||||
public static void health(Player player, double mod)
|
||||
{
|
||||
if (player.isDead())
|
||||
return;
|
||||
|
||||
double health = player.getHealth() + mod;
|
||||
|
||||
if (health < 0)
|
||||
health = 0;
|
||||
|
||||
if (health > player.getMaxHealth())
|
||||
health = player.getMaxHealth();
|
||||
|
||||
player.setHealth(health);
|
||||
}
|
||||
|
||||
public static void hunger(Player player, int mod)
|
||||
{
|
||||
if (player.isDead())
|
||||
return;
|
||||
|
||||
int hunger = player.getFoodLevel() + mod;
|
||||
|
||||
if (hunger < 0)
|
||||
hunger = 0;
|
||||
|
||||
if (hunger > 20)
|
||||
hunger = 20;
|
||||
|
||||
player.setFoodLevel(hunger);
|
||||
}
|
||||
|
||||
public static boolean isOnline(String name)
|
||||
{
|
||||
return (searchExact(name) != null);
|
||||
}
|
||||
|
||||
public static String safeNameLength(String name)
|
||||
{
|
||||
if (name.length() > 16)
|
||||
name = name.substring(0, 16);
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
public static boolean isChargingBow(Player player)
|
||||
{
|
||||
if (!UtilGear.isMat(player.getItemInHand(), Material.BOW))
|
||||
return false;
|
||||
|
||||
return (((CraftEntity)player).getHandle().getDataWatcher().getByte(0) & 1 << 4) != 0;
|
||||
}
|
||||
|
||||
public static boolean is1_8(Player player)
|
||||
{
|
||||
return ((CraftPlayer)player).getHandle().playerConnection.networkManager.getVersion() >= 47;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
public void setListName(Player player, CoreClient client)
|
||||
{
|
||||
StringBuilder playerNameBuilder = new StringBuilder();
|
||||
|
||||
public static void message(Entity client, LinkedList<String> messageList)
|
||||
{
|
||||
message(client, messageList, false);
|
||||
}
|
||||
|
||||
public static void message(Entity client, String message)
|
||||
{
|
||||
message(client, message, false);
|
||||
}
|
||||
|
||||
public static void message(Entity client, LinkedList<String> messageList, boolean wiki)
|
||||
{
|
||||
for (String curMessage : messageList)
|
||||
{
|
||||
message(client, curMessage, wiki);
|
||||
}
|
||||
}
|
||||
|
||||
public static void message(Entity client, String message, boolean wiki)
|
||||
{
|
||||
if (client == null)
|
||||
return;
|
||||
|
||||
if (!(client instanceof Player))
|
||||
return;
|
||||
|
||||
/*
|
||||
if (wiki)
|
||||
message = UtilWiki.link(message);
|
||||
*/
|
||||
|
||||
((Player) client).sendMessage(message);
|
||||
}
|
||||
|
||||
public static Player searchExact(String name)
|
||||
{
|
||||
for (Player cur : UtilServer.getPlayers())
|
||||
if (cur.getName().equalsIgnoreCase(name))
|
||||
return cur;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Player searchExact(UUID uuid)
|
||||
{
|
||||
return UtilServer.getServer().getPlayer(uuid);
|
||||
}
|
||||
|
||||
public static String searchCollection(Player caller, String player, Collection<String> coll, String collName, boolean inform)
|
||||
{
|
||||
LinkedList<String> matchList = new LinkedList<String>();
|
||||
|
||||
for (String cur : coll)
|
||||
{
|
||||
if (cur.equalsIgnoreCase(player))
|
||||
return cur;
|
||||
|
||||
if (cur.toLowerCase().contains(player.toLowerCase()))
|
||||
matchList.add(cur);
|
||||
}
|
||||
|
||||
// No / Non-Unique
|
||||
if (matchList.size() != 1)
|
||||
{
|
||||
if (!inform)
|
||||
return null;
|
||||
|
||||
// Inform
|
||||
message(caller,
|
||||
F.main(collName + " Search", "" + C.mCount + matchList.size() + C.mBody + " matches for [" + C.mElem + player
|
||||
+ C.mBody + "]."));
|
||||
|
||||
if (matchList.size() > 0)
|
||||
{
|
||||
String matchString = "";
|
||||
for (String cur : matchList)
|
||||
matchString += cur + " ";
|
||||
|
||||
message(caller,
|
||||
F.main(collName + " Search", "" + C.mBody + " Matches [" + C.mElem + matchString + C.mBody + "]."));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return matchList.get(0);
|
||||
}
|
||||
|
||||
public static Player searchOnline(Player caller, String player, boolean inform)
|
||||
{
|
||||
LinkedList<Player> matchList = new LinkedList<Player>();
|
||||
|
||||
for (Player cur : UtilServer.getPlayers())
|
||||
{
|
||||
if (cur.getName().equalsIgnoreCase(player))
|
||||
return cur;
|
||||
|
||||
if (cur.getName().toLowerCase().contains(player.toLowerCase()))
|
||||
matchList.add(cur);
|
||||
}
|
||||
|
||||
// No / Non-Unique
|
||||
if (matchList.size() != 1)
|
||||
{
|
||||
if (!inform)
|
||||
return null;
|
||||
|
||||
// Inform
|
||||
message(caller,
|
||||
F.main("Online Player Search", "" + C.mCount + matchList.size() + C.mBody + " matches for [" + C.mElem
|
||||
+ player + C.mBody + "]."));
|
||||
|
||||
if (matchList.size() > 0)
|
||||
{
|
||||
String matchString = "";
|
||||
for (Player cur : matchList)
|
||||
matchString += F.elem(cur.getName()) + ", ";
|
||||
if (matchString.length() > 1)
|
||||
matchString = matchString.substring(0, matchString.length() - 2);
|
||||
|
||||
message(caller,
|
||||
F.main("Online Player Search", "" + C.mBody + "Matches [" + C.mElem + matchString + C.mBody + "]."));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return matchList.get(0);
|
||||
}
|
||||
|
||||
public static void searchOffline(List<String> matches, final Callback<String> callback, final Player caller,
|
||||
final String player, final boolean inform)
|
||||
{
|
||||
// No / Non-Unique
|
||||
if (matches.size() != 1)
|
||||
{
|
||||
if (!inform || !caller.isOnline())
|
||||
{
|
||||
callback.run(null);
|
||||
return;
|
||||
}
|
||||
|
||||
// Inform
|
||||
message(caller,
|
||||
F.main("Offline Player Search", "" + C.mCount + matches.size() + C.mBody + " matches for [" + C.mElem
|
||||
+ player + C.mBody + "]."));
|
||||
|
||||
if (matches.size() > 0)
|
||||
{
|
||||
String matchString = "";
|
||||
for (String cur : matches)
|
||||
matchString += cur + " ";
|
||||
if (matchString.length() > 1)
|
||||
matchString = matchString.substring(0, matchString.length() - 1);
|
||||
|
||||
message(caller,
|
||||
F.main("Offline Player Search", "" + C.mBody + "Matches [" + C.mElem + matchString + C.mBody + "]."));
|
||||
}
|
||||
|
||||
callback.run(null);
|
||||
return;
|
||||
}
|
||||
|
||||
callback.run(matches.get(0));
|
||||
}
|
||||
|
||||
public static LinkedList<Player> matchOnline(Player caller, String players, boolean inform)
|
||||
{
|
||||
LinkedList<Player> matchList = new LinkedList<Player>();
|
||||
|
||||
String failList = "";
|
||||
|
||||
for (String cur : players.split(","))
|
||||
{
|
||||
Player match = searchOnline(caller, cur, inform);
|
||||
|
||||
if (match != null)
|
||||
matchList.add(match);
|
||||
|
||||
else
|
||||
failList += cur + " ";
|
||||
}
|
||||
|
||||
if (inform && failList.length() > 0)
|
||||
{
|
||||
failList = failList.substring(0, failList.length() - 1);
|
||||
message(caller, F.main("Online Player(s) Search", "" + C.mBody + "Invalid [" + C.mElem + failList + C.mBody + "]."));
|
||||
}
|
||||
|
||||
return matchList;
|
||||
}
|
||||
|
||||
public static LinkedList<Player> getNearby(Location loc, double maxDist)
|
||||
{
|
||||
LinkedList<Player> nearbyMap = new LinkedList<Player>();
|
||||
|
||||
for (Player cur : loc.getWorld().getPlayers())
|
||||
{
|
||||
if (cur.getGameMode() == GameMode.CREATIVE)
|
||||
continue;
|
||||
|
||||
if (cur.isDead())
|
||||
continue;
|
||||
|
||||
double dist = loc.toVector().subtract(cur.getLocation().toVector()).length();
|
||||
|
||||
if (dist > maxDist)
|
||||
continue;
|
||||
|
||||
for (int i = 0; i < nearbyMap.size(); i++)
|
||||
{
|
||||
if (dist < loc.toVector().subtract(nearbyMap.get(i).getLocation().toVector()).length())
|
||||
{
|
||||
nearbyMap.add(i, cur);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!nearbyMap.contains(cur))
|
||||
nearbyMap.addLast(cur);
|
||||
}
|
||||
|
||||
return nearbyMap;
|
||||
}
|
||||
|
||||
public static Player getClosest(Location loc, Collection<Player> ignore)
|
||||
{
|
||||
Player best = null;
|
||||
double bestDist = 0;
|
||||
|
||||
for (Player cur : loc.getWorld().getPlayers())
|
||||
{
|
||||
if (cur.getGameMode() == GameMode.CREATIVE)
|
||||
continue;
|
||||
|
||||
if (cur.isDead())
|
||||
continue;
|
||||
|
||||
if (ignore != null && ignore.contains(cur))
|
||||
continue;
|
||||
|
||||
double dist = UtilMath.offset(cur.getLocation(), loc);
|
||||
|
||||
if (best == null || dist < bestDist)
|
||||
{
|
||||
best = cur;
|
||||
bestDist = dist;
|
||||
}
|
||||
}
|
||||
|
||||
return best;
|
||||
}
|
||||
|
||||
public static Player getClosest(Location loc, Entity ignore)
|
||||
{
|
||||
Player best = null;
|
||||
double bestDist = 0;
|
||||
|
||||
for (Player cur : loc.getWorld().getPlayers())
|
||||
{
|
||||
if (cur.getGameMode() == GameMode.CREATIVE)
|
||||
continue;
|
||||
|
||||
if (cur.isDead())
|
||||
continue;
|
||||
|
||||
if (ignore != null && ignore.equals(cur))
|
||||
continue;
|
||||
|
||||
double dist = UtilMath.offset(cur.getLocation(), loc);
|
||||
|
||||
if (best == null || dist < bestDist)
|
||||
{
|
||||
best = cur;
|
||||
bestDist = dist;
|
||||
}
|
||||
}
|
||||
|
||||
return best;
|
||||
}
|
||||
|
||||
public static void kick(Player player, String module, String message)
|
||||
{
|
||||
kick(player, module, message, true);
|
||||
}
|
||||
|
||||
public static void kick(Player player, String module, String message, boolean log)
|
||||
{
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
String out = ChatColor.RED + module + ChatColor.WHITE + " - " + ChatColor.YELLOW + message;
|
||||
player.kickPlayer(out);
|
||||
|
||||
// Log
|
||||
if (log)
|
||||
System.out.println("Kicked Client [" + player.getName() + "] for [" + module + " - " + message + "]");
|
||||
}
|
||||
|
||||
public static HashMap<Player, Double> getInRadius(Location loc, double dR)
|
||||
{
|
||||
HashMap<Player, Double> players = new HashMap<Player, Double>();
|
||||
|
||||
for (Player cur : loc.getWorld().getPlayers())
|
||||
{
|
||||
if (cur.getGameMode() == GameMode.CREATIVE)
|
||||
continue;
|
||||
|
||||
double offset = UtilMath.offset(loc, cur.getLocation());
|
||||
|
||||
if (offset < dR)
|
||||
players.put(cur, 1 - (offset / dR));
|
||||
}
|
||||
|
||||
return players;
|
||||
}
|
||||
|
||||
public static void health(Player player, double mod)
|
||||
{
|
||||
if (player.isDead())
|
||||
return;
|
||||
|
||||
double health = player.getHealth() + mod;
|
||||
|
||||
if (health < 0)
|
||||
health = 0;
|
||||
|
||||
if (health > player.getMaxHealth())
|
||||
health = player.getMaxHealth();
|
||||
|
||||
player.setHealth(health);
|
||||
}
|
||||
|
||||
public static void hunger(Player player, int mod)
|
||||
{
|
||||
if (player.isDead())
|
||||
return;
|
||||
|
||||
int hunger = player.getFoodLevel() + mod;
|
||||
|
||||
if (hunger < 0)
|
||||
hunger = 0;
|
||||
|
||||
if (hunger > 20)
|
||||
hunger = 20;
|
||||
|
||||
player.setFoodLevel(hunger);
|
||||
}
|
||||
|
||||
public static boolean isOnline(String name)
|
||||
{
|
||||
return (searchExact(name) != null);
|
||||
}
|
||||
|
||||
public static String safeNameLength(String name)
|
||||
{
|
||||
if (name.length() > 16)
|
||||
name = name.substring(0, 16);
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
public static boolean isChargingBow(Player player)
|
||||
{
|
||||
if (!UtilGear.isMat(player.getItemInHand(), Material.BOW))
|
||||
return false;
|
||||
|
||||
return (((CraftEntity) player).getHandle().getDataWatcher().getByte(0) & 1 << 4) != 0;
|
||||
}
|
||||
|
||||
public static boolean is1_8(Player player)
|
||||
{
|
||||
return ((CraftPlayer) player).getHandle().playerConnection.networkManager.getVersion() >= 47;
|
||||
}
|
||||
|
||||
/*
|
||||
public void setListName(Player player, CoreClient client)
|
||||
{
|
||||
StringBuilder playerNameBuilder = new StringBuilder();
|
||||
|
||||
String prefixChar = "*";
|
||||
|
||||
@ -611,6 +596,6 @@ public class UtilPlayer
|
||||
}
|
||||
|
||||
player.setPlayerListName(playerName);
|
||||
}
|
||||
*/
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
@ -34,27 +34,44 @@ import net.minecraft.server.v1_7_R4.World;
|
||||
|
||||
public class CustomExplosion extends Explosion
|
||||
{
|
||||
private Player damager;
|
||||
private int i = 16;
|
||||
private World world;
|
||||
private Player _owner;
|
||||
private boolean _damageOwner;
|
||||
private int _i = 16;
|
||||
private World _world;
|
||||
private DamageManager _manager;
|
||||
private String _damageReason;
|
||||
private boolean _dropItems = true;
|
||||
|
||||
public CustomExplosion(DamageManager manager, Location loc, float explosionSize, Player damager, String deathCause,
|
||||
boolean damageAttacker)
|
||||
public CustomExplosion(DamageManager manager, Location loc, float explosionSize, String deathCause)
|
||||
{
|
||||
super(((CraftWorld) loc.getWorld()).getHandle(), null, loc.getX(), loc.getY(), loc.getZ(), explosionSize);
|
||||
this.world = ((CraftWorld) loc.getWorld()).getHandle();
|
||||
_world = ((CraftWorld) loc.getWorld()).getHandle();
|
||||
_manager = manager;
|
||||
_damageReason = deathCause;
|
||||
if (!damageAttacker)
|
||||
{
|
||||
this.damager = damager;
|
||||
}
|
||||
}
|
||||
|
||||
public CustomExplosion explode()
|
||||
{
|
||||
// Explode the explosion
|
||||
a();
|
||||
a(true);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public CustomExplosion setDropItems(boolean dropItems)
|
||||
{
|
||||
_dropItems = dropItems;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public CustomExplosion setPlayer(Player player, boolean damageExplosionOwner)
|
||||
{
|
||||
_owner = player;
|
||||
_damageOwner = damageExplosionOwner;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -68,23 +85,23 @@ public class CustomExplosion extends Explosion
|
||||
float f = this.size;
|
||||
HashSet hashset = new HashSet();
|
||||
|
||||
for (int i = 0; i < this.i; i++)
|
||||
for (int i = 0; i < this._i; i++)
|
||||
{
|
||||
for (int j = 0; j < this.i; j++)
|
||||
for (int j = 0; j < this._i; j++)
|
||||
{
|
||||
for (int k = 0; k < this.i; k++)
|
||||
for (int k = 0; k < this._i; k++)
|
||||
{
|
||||
if ((i == 0) || (i == this.i - 1) || (j == 0) || (j == this.i - 1) || (k == 0) || (k == this.i - 1))
|
||||
if ((i == 0) || (i == this._i - 1) || (j == 0) || (j == this._i - 1) || (k == 0) || (k == this._i - 1))
|
||||
{
|
||||
double d3 = i / (this.i - 1.0F) * 2.0F - 1.0F;
|
||||
double d4 = j / (this.i - 1.0F) * 2.0F - 1.0F;
|
||||
double d5 = k / (this.i - 1.0F) * 2.0F - 1.0F;
|
||||
double d3 = i / (this._i - 1.0F) * 2.0F - 1.0F;
|
||||
double d4 = j / (this._i - 1.0F) * 2.0F - 1.0F;
|
||||
double d5 = k / (this._i - 1.0F) * 2.0F - 1.0F;
|
||||
double d6 = Math.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
|
||||
|
||||
d3 /= d6;
|
||||
d4 /= d6;
|
||||
d5 /= d6;
|
||||
float f1 = this.size * (0.7F + this.world.random.nextFloat() * 0.6F);
|
||||
float f1 = this.size * (0.7F + this._world.random.nextFloat() * 0.6F);
|
||||
|
||||
double d0 = this.posX;
|
||||
double d1 = this.posY;
|
||||
@ -95,17 +112,18 @@ public class CustomExplosion extends Explosion
|
||||
int l = MathHelper.floor(d0);
|
||||
int i1 = MathHelper.floor(d1);
|
||||
int j1 = MathHelper.floor(d2);
|
||||
Block block = this.world.getType(l, i1, j1);
|
||||
Block block = this._world.getType(l, i1, j1);
|
||||
|
||||
if (block.getMaterial() != Material.AIR)
|
||||
{
|
||||
float f3 = this.source != null ? this.source.a(this, this.world, l, i1, j1, block) : block
|
||||
float f3 = this.source != null ? this.source.a(this, this._world, l, i1, j1, block) : block
|
||||
.a(this.source);
|
||||
|
||||
f1 -= (f3 + 0.3F) * f2;
|
||||
}
|
||||
|
||||
if ((f1 > 0.0F) && ((this.source == null) || (this.source.a(this, this.world, l, i1, j1, block, f1)))
|
||||
if ((f1 > 0.0F)
|
||||
&& ((this.source == null) || (this.source.a(this, this._world, l, i1, j1, block, f1)))
|
||||
&& (i1 < 256) && (i1 >= 0))
|
||||
{
|
||||
hashset.add(new ChunkPosition(l, i1, j1));
|
||||
@ -122,20 +140,22 @@ public class CustomExplosion extends Explosion
|
||||
|
||||
this.blocks.addAll(hashset);
|
||||
this.size *= 2.0F;
|
||||
i = MathHelper.floor(this.posX - this.size - 1.0D);
|
||||
_i = MathHelper.floor(this.posX - this.size - 1.0D);
|
||||
int j = MathHelper.floor(this.posX + this.size + 1.0D);
|
||||
int k = MathHelper.floor(this.posY - this.size - 1.0D);
|
||||
int k1 = MathHelper.floor(this.posY + this.size + 1.0D);
|
||||
int l1 = MathHelper.floor(this.posZ - this.size - 1.0D);
|
||||
int i2 = MathHelper.floor(this.posZ + this.size + 1.0D);
|
||||
List list = this.world.getEntities(this.source, AxisAlignedBB.a(i, k, l1, j, k1, i2));
|
||||
List list = this._world.getEntities(this.source, AxisAlignedBB.a(_i, k, l1, j, k1, i2));
|
||||
Vec3D vec3d = Vec3D.a(this.posX, this.posY, this.posZ);
|
||||
|
||||
for (int j2 = 0; j2 < list.size(); j2++)
|
||||
{
|
||||
Entity entity = (Entity) list.get(j2);
|
||||
if (entity.getBukkitEntity() == damager)
|
||||
|
||||
if (entity.getBukkitEntity() == _owner && !_damageOwner)
|
||||
continue;
|
||||
|
||||
double d7 = entity.f(this.posX, this.posY, this.posZ) / this.size;
|
||||
|
||||
if (d7 <= 1.0D)
|
||||
@ -150,20 +170,20 @@ public class CustomExplosion extends Explosion
|
||||
d0 /= d8;
|
||||
d1 /= d8;
|
||||
d2 /= d8;
|
||||
double d9 = this.world.a(vec3d, entity.boundingBox);
|
||||
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);
|
||||
|
||||
if (entity.getBukkitEntity() instanceof LivingEntity)
|
||||
{
|
||||
_manager.NewDamageEvent((LivingEntity) entity.getBukkitEntity(), damager, null,
|
||||
_manager.NewDamageEvent((LivingEntity) entity.getBukkitEntity(), _owner, null,
|
||||
DamageCause.ENTITY_EXPLOSION, damage, true, true, false, _damageReason, _damageReason);
|
||||
}
|
||||
else
|
||||
{
|
||||
CraftEventFactory.entityDamage = this.source;
|
||||
if (!entity.damageEntity(DamageSource.explosion(this), damage))
|
||||
;
|
||||
; // Yeah I don't get this either. But its in the source.
|
||||
CraftEventFactory.entityDamage = null;
|
||||
}
|
||||
|
||||
@ -186,18 +206,18 @@ public class CustomExplosion extends Explosion
|
||||
@Override
|
||||
public void a(boolean flag)
|
||||
{
|
||||
this.world.makeSound(this.posX, this.posY, this.posZ, "random.explode", 4.0F,
|
||||
(1.0F + (this.world.random.nextFloat() - this.world.random.nextFloat()) * 0.2F) * 0.7F);
|
||||
this._world.makeSound(this.posX, this.posY, this.posZ, "random.explode", 4.0F,
|
||||
(1.0F + (this._world.random.nextFloat() - this._world.random.nextFloat()) * 0.2F) * 0.7F);
|
||||
if ((this.size >= 2.0F) && (this.b))
|
||||
this.world.addParticle("hugeexplosion", this.posX, this.posY, this.posZ, 1.0D, 0.0D, 0.0D);
|
||||
this._world.addParticle("hugeexplosion", this.posX, this.posY, this.posZ, 1.0D, 0.0D, 0.0D);
|
||||
else
|
||||
{
|
||||
this.world.addParticle("largeexplode", this.posX, this.posY, this.posZ, 1.0D, 0.0D, 0.0D);
|
||||
this._world.addParticle("largeexplode", this.posX, this.posY, this.posZ, 1.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
if (this.b)
|
||||
{
|
||||
org.bukkit.World bworld = this.world.getWorld();
|
||||
org.bukkit.World bworld = this._world.getWorld();
|
||||
|
||||
List blockList = new ArrayList();
|
||||
ChunkPosition cpos;
|
||||
@ -211,8 +231,8 @@ public class CustomExplosion extends Explosion
|
||||
}
|
||||
}
|
||||
|
||||
ExplosionEvent event = damager == null ? new ExplosionEvent(blockList) : new ExplosionEvent(blockList, damager);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
ExplosionEvent event = _owner == null ? new ExplosionEvent(blockList) : new ExplosionEvent(blockList, _owner);
|
||||
this._world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
this.blocks.clear();
|
||||
|
||||
@ -236,13 +256,13 @@ public class CustomExplosion extends Explosion
|
||||
int i = chunkposition.x;
|
||||
int j = chunkposition.y;
|
||||
int k = chunkposition.z;
|
||||
Block block = this.world.getType(i, j, k);
|
||||
this.world.spigotConfig.antiXrayInstance.updateNearbyBlocks(this.world, i, j, k);
|
||||
Block block = this._world.getType(i, j, k);
|
||||
this._world.spigotConfig.antiXrayInstance.updateNearbyBlocks(this._world, i, j, k);
|
||||
if (flag)
|
||||
{
|
||||
double d0 = i + this.world.random.nextFloat();
|
||||
double d1 = j + this.world.random.nextFloat();
|
||||
double d2 = k + this.world.random.nextFloat();
|
||||
double d0 = i + this._world.random.nextFloat();
|
||||
double d1 = j + this._world.random.nextFloat();
|
||||
double d2 = k + this._world.random.nextFloat();
|
||||
double d3 = d0 - this.posX;
|
||||
double d4 = d1 - this.posY;
|
||||
double d5 = d2 - this.posZ;
|
||||
@ -253,24 +273,24 @@ public class CustomExplosion extends Explosion
|
||||
d5 /= d6;
|
||||
double d7 = 0.5D / (d6 / this.size + 0.1D);
|
||||
|
||||
d7 *= (this.world.random.nextFloat() * this.world.random.nextFloat() + 0.3F);
|
||||
d7 *= (this._world.random.nextFloat() * this._world.random.nextFloat() + 0.3F);
|
||||
d3 *= d7;
|
||||
d4 *= d7;
|
||||
d5 *= d7;
|
||||
this.world.addParticle("explode", (d0 + this.posX * 1.0D) / 2.0D, (d1 + this.posY * 1.0D) / 2.0D,
|
||||
this._world.addParticle("explode", (d0 + this.posX * 1.0D) / 2.0D, (d1 + this.posY * 1.0D) / 2.0D,
|
||||
(d2 + this.posZ * 1.0D) / 2.0D, d3, d4, d5);
|
||||
this.world.addParticle("smoke", d0, d1, d2, d3, d4, d5);
|
||||
this._world.addParticle("smoke", d0, d1, d2, d3, d4, d5);
|
||||
}
|
||||
|
||||
if (block.getMaterial() != Material.AIR)
|
||||
{
|
||||
if (block.a(this))
|
||||
if (block.a(this) && _dropItems)
|
||||
{
|
||||
block.dropNaturally(this.world, i, j, k, this.world.getData(i, j, k), size, 0);
|
||||
block.dropNaturally(this._world, i, j, k, this._world.getData(i, j, k), size, 0);
|
||||
}
|
||||
|
||||
this.world.setTypeAndData(i, j, k, Blocks.AIR, 0, 3);
|
||||
block.wasExploded(this.world, i, j, k, this);
|
||||
this._world.setTypeAndData(i, j, k, Blocks.AIR, 0, 3);
|
||||
block.wasExploded(this._world, i, j, k, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -285,13 +305,13 @@ public class CustomExplosion extends Explosion
|
||||
int i = chunkposition.x;
|
||||
int j = chunkposition.y;
|
||||
int k = chunkposition.z;
|
||||
Block block = this.world.getType(i, j, k);
|
||||
Block block1 = this.world.getType(i, j - 1, k);
|
||||
Block block = this._world.getType(i, j, k);
|
||||
Block block1 = this._world.getType(i, j - 1, k);
|
||||
|
||||
if ((block.getMaterial() == Material.AIR) && (block1.j()) && (new Random().nextInt(3) == 0))
|
||||
{
|
||||
if (!CraftEventFactory.callBlockIgniteEvent(this.world, i, j, k, this).isCancelled())
|
||||
this.world.setTypeUpdate(i, j, k, Blocks.FIRE);
|
||||
if (!CraftEventFactory.callBlockIgniteEvent(this._world, i, j, k, this).isCancelled())
|
||||
this._world.setTypeUpdate(i, j, k, Blocks.FIRE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -52,6 +52,7 @@ public enum GameType
|
||||
TurfWars("Turf Wars", Material.STAINED_CLAY, (byte)14, GameCategory.ARCADE),
|
||||
UHC("Ultra Hardcore", Material.GOLDEN_APPLE, (byte)0, GameCategory.SURVIVAL),
|
||||
WitherAssault("Wither Assault", Material.SKULL_ITEM, (byte)1, GameCategory.ARCADE),
|
||||
WizardBattles("Wizard Battles", Material.BLAZE_ROD, (byte)0, GameCategory.SURVIVAL),
|
||||
ZombieSurvival("Zombie Survival", Material.SKULL_ITEM, (byte)2, GameCategory.SURVIVAL);
|
||||
|
||||
String _name;
|
||||
|
@ -1,14 +1,17 @@
|
||||
package nautilus.game.arcade.game.games.wizards;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.shop.item.SingleButton;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
|
||||
import mineplex.core.shop.item.IButton;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class SpellButton extends SingleButton
|
||||
public class SpellButton implements IButton
|
||||
{
|
||||
|
||||
private SpellType _spell;
|
||||
@ -21,7 +24,7 @@ public class SpellButton extends SingleButton
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Clicked(Player player)
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
Wizard wizard = _spellPage.getWizards().getWizard(player);
|
||||
|
||||
|
@ -46,7 +46,7 @@ public enum SpellType // ❤
|
||||
|
||||
"and a mighty dirt bridge will appear!"),
|
||||
|
||||
Drain(SpellElement.MISC, // Spell element
|
||||
/*Drain(SpellElement.MISC, // Spell element
|
||||
"Drain", // Spell name
|
||||
new ItemStack(Material.BUCKET), // Spell icon
|
||||
SpellDrain.class, // Spell class
|
||||
@ -57,15 +57,13 @@ public enum SpellType // ❤
|
||||
-4, // Cooldown change per level
|
||||
3, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Drained Mana: " + C.Bold + C.cWhite + "Spell Level x 40",
|
||||
|
||||
"",
|
||||
|
||||
"Right click other players with this spell",
|
||||
|
||||
"to empty their mana reserves!",
|
||||
"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!"),
|
||||
"You gain a third of the absorbed mana!"),*/
|
||||
|
||||
Droom(SpellElement.ATTACK, // Spell element
|
||||
"Droom", // Spell name
|
||||
@ -76,7 +74,7 @@ public enum SpellType // ❤
|
||||
15, // Spell cooldown
|
||||
-3, // Mana cost change per level
|
||||
-4, // Cooldown change per level
|
||||
3, // Item amount in loot
|
||||
10, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Explosion Size: " + C.Bold + C.cWhite + "(Spell Level / 2) + 1",
|
||||
|
||||
@ -112,9 +110,9 @@ public enum SpellType // ❤
|
||||
15, // Spell cooldown
|
||||
-3, // Mana cost change per level
|
||||
-2, // Cooldown change per level
|
||||
5, // Item amount in loot
|
||||
10, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Explosion Size: " + C.Bold + C.cWhite + "Spell Level x 0.8",
|
||||
C.cGold + C.Bold + "Explosion Size: " + C.Bold + C.cWhite + "(Spell Level x 0.5) + 0.5",
|
||||
|
||||
"",
|
||||
|
||||
@ -211,7 +209,7 @@ public enum SpellType // ❤
|
||||
50, // Spell cooldown
|
||||
0, // Mana cost change per level
|
||||
-10, // Cooldown change per level
|
||||
3, // Item amount in loot
|
||||
10, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Lance Size: " + C.Bold + C.cWhite + "Spell Level x 6",
|
||||
|
||||
@ -253,7 +251,7 @@ public enum SpellType // ❤
|
||||
20, // Spell cooldown
|
||||
0, // Mana cost change per level
|
||||
0, // Cooldown change per level
|
||||
3, // Item amount in loot
|
||||
10, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Length: " + C.Bold + C.cWhite + "Spell Level x 10",
|
||||
|
||||
@ -272,7 +270,7 @@ public enum SpellType // ❤
|
||||
5, // Spell cooldown
|
||||
-2, // Mana cost change per level
|
||||
-1, // Cooldown change per level
|
||||
10, // Item amount in loot
|
||||
15, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Damage: " + C.Bold + C.cWhite + "(Spell Level / 2) + 2.5",
|
||||
|
||||
@ -293,9 +291,9 @@ public enum SpellType // ❤
|
||||
8, // Spell cooldown
|
||||
3, // Mana cost change per level
|
||||
1, // Cooldown change per level
|
||||
3, // Item amount in loot
|
||||
10, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Damage: " + C.Bold + C.cWhite + "Spell Level + 2.5",
|
||||
C.cGold + C.Bold + "Damage: " + C.Bold + C.cWhite + "Spell Level + 2",
|
||||
|
||||
C.cGold + C.Bold + "Ramge: " + C.Bold + C.cWhite + "Spell Level x 20",
|
||||
|
||||
@ -316,9 +314,9 @@ public enum SpellType // ❤
|
||||
5, // Spell cooldown
|
||||
0, // Mana cost change per level
|
||||
0, // Cooldown change per level
|
||||
3, // Item amount in loot
|
||||
10, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Damage: " + C.Bold + C.cWhite + "(Spell Level / 2) + 2.5",
|
||||
C.cGold + C.Bold + "Damage: " + C.Bold + C.cWhite + "(Spell Level / 2) + 3.5",
|
||||
|
||||
C.cGold + C.Bold + "Range: " + C.Bold + C.cWhite + "Spell Level x 10",
|
||||
|
||||
@ -341,7 +339,7 @@ public enum SpellType // ❤
|
||||
0, // Cooldown change per level
|
||||
3, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Length: " + C.Bold + C.cWhite + "(Spell Level x 30) + 60",
|
||||
C.cGold + C.Bold + "Length: " + C.Bold + C.cWhite + "Spell Level x 30",
|
||||
|
||||
C.cGold + C.Bold + "Strength: " + C.Bold + C.cWhite + "Spell Level",
|
||||
|
||||
@ -355,7 +353,7 @@ public enum SpellType // ❤
|
||||
SpellStoneWall.class, // Spell class
|
||||
3, // Spell max level
|
||||
60, // Mana cost
|
||||
10, // Spell cooldown
|
||||
30, // Spell cooldown
|
||||
0, // Mana cost change per level
|
||||
-5, // Cooldown change per level
|
||||
3, // Item amount in loot
|
||||
@ -377,7 +375,7 @@ public enum SpellType // ❤
|
||||
160, // Spell cooldown
|
||||
-10, // Mana cost change per level
|
||||
0, // Cooldown change per level
|
||||
3, // Item amount in loot
|
||||
8, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Wolves: " + C.Bold + C.cWhite + "Spell Level + 2",
|
||||
|
||||
@ -385,7 +383,7 @@ public enum SpellType // ❤
|
||||
|
||||
"Summons a pack of wolves and turns you into the leader.",
|
||||
|
||||
"They will fight for you and after three minutes, will disappear"),
|
||||
"They will fight for you and after a minute, will disappear"),
|
||||
|
||||
TeleportRune(SpellElement.RUNES, // Spell element
|
||||
"Teleport Rune", // Spell name
|
||||
@ -396,7 +394,7 @@ public enum SpellType // ❤
|
||||
40, // Spell cooldown
|
||||
-5, // Mana cost change per level
|
||||
-5, // Cooldown change per level
|
||||
10, // Item amount in loot
|
||||
4, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Range: " + C.Bold + C.cWhite + "Spell Level x 25",
|
||||
|
||||
@ -421,7 +419,7 @@ public enum SpellType // ❤
|
||||
30, // Spell cooldown
|
||||
0, // Mana cost change per level
|
||||
-5, // Cooldown change per level
|
||||
30, // Item amount in loot
|
||||
3, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Range: " + C.Bold + C.cWhite + "(Spell Level x 4) + 12",
|
||||
|
||||
|
@ -11,6 +11,17 @@ public class Wizard
|
||||
private float _mana;
|
||||
private float _manaPerTick = 2.5F / 20F;
|
||||
private float _maxMana;
|
||||
private int soulStars;
|
||||
|
||||
public int getSoulStars()
|
||||
{
|
||||
return soulStars;
|
||||
}
|
||||
|
||||
public void addSoulStar()
|
||||
{
|
||||
soulStars++;
|
||||
}
|
||||
|
||||
public Wizard(float maxMana)
|
||||
{
|
||||
@ -45,7 +56,7 @@ public class Wizard
|
||||
|
||||
public float getManaPerTick()
|
||||
{
|
||||
return _manaPerTick;
|
||||
return _manaPerTick + ((soulStars * 0.1F) / 20);
|
||||
}
|
||||
|
||||
public float getMaxMana()
|
||||
|
@ -15,6 +15,7 @@ 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 mineplex.core.common.util.UtilTextBottom;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilTextTop;
|
||||
@ -25,15 +26,17 @@ import mineplex.core.hologram.Hologram;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.combat.CombatManager.AttackReason;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.SoloGame;
|
||||
import nautilus.game.arcade.game.games.wizards.kit.*;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellRightClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellRightClickBlock;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellRightClickEntity;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClickBlock;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClickEntity;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import net.minecraft.server.v1_7_R4.EntityFireball;
|
||||
|
||||
import org.apache.commons.lang.IllegalClassException;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -46,7 +49,10 @@ import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.Chest;
|
||||
import org.bukkit.block.DoubleChest;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftFireball;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Fireball;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -61,7 +67,6 @@ import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.event.inventory.PrepareItemCraftEvent;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerItemHeldEvent;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
@ -72,6 +77,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
import org.bukkit.inventory.Recipe;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class WizardBattles extends SoloGame
|
||||
@ -84,7 +90,7 @@ public class WizardBattles extends SoloGame
|
||||
private NautHashMap<SpellType, Spell> _spells = new NautHashMap<SpellType, Spell>();
|
||||
private NautHashMap<String, Long> _timeSinceDisplayedMiddle = new NautHashMap<String, Long>();
|
||||
private WizardSpellMenu _wizard;
|
||||
|
||||
private ArrayList<Item> _droppedWandsBooks = new ArrayList<Item>();
|
||||
private NautHashMap<String, Wizard> _wizards = new NautHashMap<String, Wizard>();
|
||||
|
||||
public WizardBattles(ArcadeManager manager)
|
||||
@ -125,12 +131,14 @@ public class WizardBattles extends SoloGame
|
||||
AllowParticles = false;
|
||||
DamageTeamSelf = true;
|
||||
|
||||
Manager.GetDamage().GetCombatManager().setUseWeaponName(AttackReason.DefaultWeaponName);
|
||||
|
||||
createLoot();
|
||||
}
|
||||
|
||||
private void addMiddleText(Player p, String message)
|
||||
{
|
||||
ArrayList<String> arraylist;
|
||||
ArrayList<String> arraylist = new ArrayList<String>();
|
||||
|
||||
if (_learnedSpellChests.containsKey(p.getName()))
|
||||
{
|
||||
@ -138,7 +146,6 @@ public class WizardBattles extends SoloGame
|
||||
}
|
||||
else
|
||||
{
|
||||
arraylist = new ArrayList<String>();
|
||||
_learnedSpellChests.put(p.getName(), arraylist);
|
||||
}
|
||||
|
||||
@ -193,11 +200,11 @@ public class WizardBattles extends SoloGame
|
||||
|
||||
C.cYellow + "Cooldown " + ChatColor.RESET
|
||||
|
||||
+ UtilTime.convertString((long) (type.getSpellCooldown(spellLevel) * 1000), 0, TimeUnit.FIT);
|
||||
+ UtilTime.convertString((long) (type.getSpellCooldown(spellLevel) * 1000), 1, TimeUnit.FIT);
|
||||
}
|
||||
else
|
||||
{
|
||||
display = C.cWhite + "Left click to set a spell";
|
||||
display = C.cWhite + "Right click to set a spell";
|
||||
}
|
||||
|
||||
if (!meta.hasDisplayName() || !meta.getDisplayName().equals(display))
|
||||
@ -272,8 +279,6 @@ public class WizardBattles extends SoloGame
|
||||
addRandomItem(5, Material.CARROT_ITEM, 0, 1, 2);
|
||||
addRandomItem(5, Material.WHEAT, 0, 1, 2);
|
||||
addRandomItem(1, Material.TNT, 0, 1, 1);
|
||||
// Below is cocoa beans
|
||||
addRandomItem(5, Material.INK_SACK, 3, 1, 2);
|
||||
addRandomItem(5, Material.ROTTEN_FLESH, 0, 1, 2);
|
||||
addRandomItem(5, Material.STICK, 0, 1, 2);
|
||||
addRandomItem(5, Material.WOOD, 0, 1, 10);
|
||||
@ -293,10 +298,8 @@ public class WizardBattles extends SoloGame
|
||||
addRandomItem(5, Material.CHAINMAIL_HELMET, 0, 1, 1);
|
||||
addRandomItem(5, Material.CHAINMAIL_LEGGINGS, 0, 1, 1);
|
||||
addRandomItem(5, Material.FISHING_ROD, 0, 1, 1);
|
||||
addRandomItem(5, Material.BOW, 0, 1, 1);
|
||||
addRandomItem(5, Material.ARROW, 0, 1, 5);
|
||||
addRandomItem(5, Material.SNOW_BALL, 0, 1, 2);
|
||||
addRandomItem(5, Material.EGG, 0, 1, 2);
|
||||
// addRandomItem(5, Material.BOW, 0, 1, 1);
|
||||
// addRandomItem(5, Material.ARROW, 0, 1, 5);
|
||||
addRandomItem(5, Material.PORK, 0, 1, 2);
|
||||
addRandomItem(5, Material.BAKED_POTATO, 0, 1, 2);
|
||||
addRandomItem(5, Material.CAKE, 0, 1, 1);
|
||||
@ -307,7 +310,6 @@ public class WizardBattles extends SoloGame
|
||||
addRandomItem(5, Material.COOKIE, 0, 1, 2);
|
||||
addRandomItem(5, Material.PUMPKIN_PIE, 0, 1, 2);
|
||||
addRandomItem(5, Material.APPLE, 0, 1, 2);
|
||||
addRandomItem(5, Material.BOWL, 0, 1, 2);
|
||||
addRandomItem(5, Material.IRON_INGOT, 0, 1, 2);
|
||||
addRandomItem(5, Material.DIAMOND, 0, 1, 1);
|
||||
addRandomItem(5, Material.EXP_BOTTLE, 0, 1, 2);
|
||||
@ -407,12 +409,21 @@ public class WizardBattles extends SoloGame
|
||||
{
|
||||
HashSet<SpellType> spells = new HashSet<SpellType>();
|
||||
Wizard wizard = getWizard(player);
|
||||
int wandsHeld = 0;
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
ItemStack item = player.getInventory().getItem(i);
|
||||
|
||||
if (item.getType() == Material.BLAZE_ROD)
|
||||
{
|
||||
wandsHeld++;
|
||||
}
|
||||
|
||||
player.getInventory().setItem(i, new ItemStack(Material.AIR));
|
||||
|
||||
SpellType type = wizard.getSpell(i);
|
||||
|
||||
if (type != null && type != SpellType.MagicMissile)
|
||||
{
|
||||
spells.add(type);
|
||||
@ -426,11 +437,13 @@ public class WizardBattles extends SoloGame
|
||||
itemsToDrop.add(type.getSpellBook(this));
|
||||
}
|
||||
|
||||
if (UtilMath.r(5) == 0)
|
||||
if (wandsHeld > 3 || UtilMath.r(3) == 0)
|
||||
{
|
||||
itemsToDrop.add(makeUnusedWand());
|
||||
}
|
||||
|
||||
itemsToDrop.add(new ItemBuilder(Material.NETHER_STAR).setTitle(buildTime()).build());
|
||||
|
||||
Collections.shuffle(itemsToDrop, new Random());
|
||||
|
||||
double beginnerAngle = Math.random() * 360;
|
||||
@ -513,9 +526,9 @@ public class WizardBattles extends SoloGame
|
||||
|
||||
builder.addLore(
|
||||
|
||||
C.cGreen + C.Bold + "LEFT CLICK" + C.cBlue + " Open Spellbook",
|
||||
C.cPurple + C.Bold + "LEFT CLICK" + C.cDGreen + " Cast spell",
|
||||
|
||||
C.cPurple + C.Bold + "RIGHT CLICK" + C.cDGreen + " Cast spell");
|
||||
C.cGreen + C.Bold + "RIGHT CLICK" + C.cBlue + " Open Spellbook");
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
@ -524,7 +537,7 @@ public class WizardBattles extends SoloGame
|
||||
{
|
||||
ItemStack item = player.getItemInHand();
|
||||
|
||||
if (GetState() == GameState.Live && IsAlive(player) && item != null && item.getType() == Material.BLAZE_ROD
|
||||
if (IsLive() && IsAlive(player) && item != null && item.getType() == Material.BLAZE_ROD
|
||||
&& player.getInventory().getHeldItemSlot() < 5)
|
||||
{
|
||||
|
||||
@ -545,17 +558,17 @@ public class WizardBattles extends SoloGame
|
||||
{
|
||||
|
||||
Spell sp = _spells.get(spell);
|
||||
if (obj instanceof Block && sp instanceof SpellRightClickBlock)
|
||||
if (obj instanceof Block && sp instanceof SpellClickBlock)
|
||||
{
|
||||
((SpellRightClickBlock) sp).castSpell(player, (Block) obj);
|
||||
((SpellClickBlock) sp).castSpell(player, (Block) obj);
|
||||
}
|
||||
else if (obj instanceof Entity && sp instanceof SpellRightClickEntity)
|
||||
else if (obj instanceof Entity && sp instanceof SpellClickEntity)
|
||||
{
|
||||
((SpellRightClickEntity) sp).castSpell(player, (Entity) obj);
|
||||
((SpellClickEntity) sp).castSpell(player, (Entity) obj);
|
||||
}
|
||||
else if (sp instanceof SpellRightClick)
|
||||
else if (sp instanceof SpellClick)
|
||||
{
|
||||
((SpellRightClick) sp).castSpell(player);
|
||||
((SpellClick) sp).castSpell(player);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -645,11 +658,13 @@ public class WizardBattles extends SoloGame
|
||||
@EventHandler
|
||||
public void onDamage(EntityDamageByEntityEvent event)
|
||||
{
|
||||
if (event.getDamager() instanceof Player)
|
||||
if (IsAlive(event.getDamager()))
|
||||
{
|
||||
if (event.getDamage() > 1)
|
||||
onCastSpell((Player) event.getDamager(), event.getEntity());
|
||||
|
||||
if (event.getDamage() > 0.5)
|
||||
{
|
||||
event.setDamage(1);
|
||||
event.setDamage(0.5);
|
||||
if (event.getEntity() instanceof LivingEntity)
|
||||
{
|
||||
UtilParticle.PlayParticle((Player) event.getDamager(), ParticleType.HEART,
|
||||
@ -667,15 +682,18 @@ public class WizardBattles extends SoloGame
|
||||
dropSpells(event.getEntity());
|
||||
|
||||
Iterator<ItemStack> itel = event.getDrops().iterator();
|
||||
|
||||
while (itel.hasNext())
|
||||
{
|
||||
ItemStack item = itel.next();
|
||||
if (item.getType() == Material.BLAZE_ROD)
|
||||
|
||||
if (item.getType() == Material.BLAZE_ROD || item.getType() == Material.STAINED_GLASS_PANE)
|
||||
{
|
||||
itel.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_wizards.remove(event.getEntity().getName());
|
||||
}
|
||||
|
||||
@ -706,6 +724,8 @@ public class WizardBattles extends SoloGame
|
||||
|
||||
holo.start();
|
||||
|
||||
_droppedWandsBooks.add(event.getEntity());
|
||||
|
||||
}
|
||||
}
|
||||
else if (item.getType() == Material.BLAZE_ROD)
|
||||
@ -722,6 +742,24 @@ public class WizardBattles extends SoloGame
|
||||
holo.setRemoveOnEntityDeath();
|
||||
|
||||
holo.start();
|
||||
|
||||
_droppedWandsBooks.add(event.getEntity());
|
||||
}
|
||||
else if (item.getType() == Material.NETHER_STAR)
|
||||
{
|
||||
Hologram holo = new Hologram(getArcadeManager().getHologramManager(),
|
||||
|
||||
event.getEntity().getLocation().add(0, 1, 0),
|
||||
|
||||
C.Bold + "Soul Star");
|
||||
|
||||
holo.setFollowEntity(event.getEntity());
|
||||
|
||||
holo.setRemoveOnEntityDeath();
|
||||
|
||||
holo.start();
|
||||
|
||||
_droppedWandsBooks.add(event.getEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@ -745,7 +783,7 @@ public class WizardBattles extends SoloGame
|
||||
{
|
||||
Spell spell = spells.getSpellClass().newInstance();
|
||||
|
||||
if (!(spell instanceof SpellRightClick || spell instanceof SpellRightClickBlock || spell instanceof SpellRightClickEntity))
|
||||
if (!(spell instanceof SpellClick || spell instanceof SpellClickBlock || spell instanceof SpellClickEntity))
|
||||
throw new IllegalClassException(spells.getSpellName() + "'s spell class doesn't extend a spell interface");
|
||||
|
||||
spell.setSpellType(spells);
|
||||
@ -778,14 +816,32 @@ public class WizardBattles extends SoloGame
|
||||
if (slot >= 0 && slot < 5)
|
||||
{
|
||||
p.getInventory().setItem(slot,
|
||||
new ItemBuilder(makeUnusedWand()).setTitle(C.cWhite + "Left click to set a spell").build());
|
||||
new ItemBuilder(makeUnusedWand()).setTitle(C.cWhite + "Right click to set a spell").build());
|
||||
|
||||
p.updateInventory();
|
||||
|
||||
addMiddleText(p, C.cGold + "Gained a wand");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
else
|
||||
{
|
||||
Wizard wizard = getWizard(p);
|
||||
|
||||
if (wizard.getMana() < wizard.getMaxMana())
|
||||
{
|
||||
wizard.setMana(wizard.getMaxMana());
|
||||
addMiddleText(p, ChatColor.GOLD + "Converted wand into mana");
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void onGainSoulStar(Player p)
|
||||
{
|
||||
Wizard wizard = getWizard(p);
|
||||
addMiddleText(p, ChatColor.GOLD + "Soul Star collected");
|
||||
wizard.addSoulStar();
|
||||
displaySpellWand(p);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -805,24 +861,24 @@ public class WizardBattles extends SoloGame
|
||||
{
|
||||
|
||||
Player p = event.getPlayer();
|
||||
if (event.getAction().name().contains("RIGHT"))
|
||||
if (event.getAction().name().contains("LEFT"))
|
||||
{
|
||||
|
||||
if (item.getType() == Material.BLAZE_ROD)
|
||||
{
|
||||
|
||||
onCastSpell(p, event.getClickedBlock());
|
||||
if (event.getClickedBlock() == null || !(event.getClickedBlock().getState() instanceof InventoryHolder))
|
||||
{
|
||||
|
||||
onCastSpell(p, event.getClickedBlock());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onInteractEntity(PlayerInteractEntityEvent event)
|
||||
{
|
||||
onCastSpell(event.getPlayer(), event.getRightClicked());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onItemClick(InventoryClickEvent event)
|
||||
{
|
||||
@ -880,7 +936,7 @@ public class WizardBattles extends SoloGame
|
||||
if (IsAlive(p))
|
||||
{
|
||||
|
||||
if (event.getItem().getItemStack().getType() == Material.BLAZE_ROD)
|
||||
if (item.getType() == Material.BLAZE_ROD)
|
||||
{
|
||||
|
||||
if (onGainWand(p))
|
||||
@ -911,6 +967,13 @@ public class WizardBattles extends SoloGame
|
||||
}
|
||||
|
||||
}
|
||||
else if (item.getType() == Material.NETHER_STAR)
|
||||
{
|
||||
onGainSoulStar(p);
|
||||
|
||||
event.setCancelled(true);
|
||||
event.getItem().remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -929,9 +992,38 @@ public class WizardBattles extends SoloGame
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onSecond(UpdateEvent event)
|
||||
public void checkPickupBooks(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() == UpdateType.TICK)
|
||||
if (event.getType() == UpdateType.TICK && IsLive())
|
||||
{
|
||||
Iterator<Item> itel = _droppedWandsBooks.iterator();
|
||||
|
||||
while (itel.hasNext())
|
||||
{
|
||||
Item item = itel.next();
|
||||
|
||||
if (item.isValid())
|
||||
{
|
||||
Player player = UtilPlayer.getClosest(item.getLocation(), (Entity) null);
|
||||
|
||||
if (player != null && player.getLocation().distance(item.getLocation()) < 1.7)
|
||||
{
|
||||
onPickup(new PlayerPickupItemEvent(player, item, 0));
|
||||
}
|
||||
}
|
||||
|
||||
if (!item.isValid())
|
||||
{
|
||||
itel.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateMiddleText(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() == UpdateType.TICK && IsLive())
|
||||
{
|
||||
Iterator<Entry<String, ArrayList<String>>> itel = _learnedSpellChests.entrySet().iterator();
|
||||
|
||||
@ -947,7 +1039,7 @@ public class WizardBattles extends SoloGame
|
||||
// If 40 ticks has passed since last sent the middle text, send another.
|
||||
|
||||
if ((!_timeSinceDisplayedMiddle.containsKey(entry.getKey()) || _timeSinceDisplayedMiddle.get(entry.getKey()) <= System
|
||||
.currentTimeMillis()) && p.getOpenInventory().getType() == InventoryType.PLAYER)
|
||||
.currentTimeMillis()) && p.getOpenInventory().getTopInventory().getHolder() == p)
|
||||
{
|
||||
|
||||
UtilTextMiddle.display("", entry.getValue().remove(0), 5, 30, 5, p);
|
||||
@ -955,13 +1047,12 @@ public class WizardBattles extends SoloGame
|
||||
if (entry.getValue().isEmpty())
|
||||
{
|
||||
itel.remove();
|
||||
_timeSinceDisplayedMiddle.remove(entry.getKey());
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
|
||||
_timeSinceDisplayedMiddle.put(entry.getKey(), System.currentTimeMillis() + (40 * 1000L));
|
||||
_timeSinceDisplayedMiddle.put(entry.getKey(), System.currentTimeMillis() + 3000L);
|
||||
|
||||
}
|
||||
|
||||
@ -981,12 +1072,18 @@ public class WizardBattles extends SoloGame
|
||||
Wizard wiz = getWizard(p);
|
||||
|
||||
int spellLevel = wiz.getSpellLevel(spell);
|
||||
|
||||
if (spellLevel < spell.getMaxLevel())
|
||||
{
|
||||
wiz.learnSpell(spell);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
else if (wiz.getMana() < wiz.getMaxMana())
|
||||
{
|
||||
wiz.setMana(Math.min(wiz.getMaxMana(), wiz.getMana() + 50));
|
||||
addMiddleText(p, ChatColor.GOLD + "Converted spellbook into mana");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -1013,7 +1110,7 @@ public class WizardBattles extends SoloGame
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onTick(UpdateEvent event)
|
||||
public void updateMana(UpdateEvent event)
|
||||
{
|
||||
if ((event.getType() == UpdateType.TICK) && GetState() == GameState.Live)
|
||||
{
|
||||
@ -1071,15 +1168,89 @@ public class WizardBattles extends SoloGame
|
||||
CreateChestCraftEnchant();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onSecond(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() == UpdateType.TWOSEC && IsLive() && System.currentTimeMillis() > getGameLiveTime() + (0 * 60 * 1000))
|
||||
{
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
Vector vector = new Vector(UtilMath.random.nextDouble() - 0.5, 0.8, UtilMath.random.nextDouble() - 0.5)
|
||||
.normalize();
|
||||
|
||||
vector.multiply(30);
|
||||
|
||||
Location loc = player.getLocation();
|
||||
|
||||
loc.add((UtilMath.random.nextDouble() - 0.5) * 7, 0, (UtilMath.random.nextDouble() - 0.5) * 7);
|
||||
|
||||
loc.add(vector);
|
||||
|
||||
final Fireball fireball = (Fireball) player.getWorld().spawnEntity(loc, EntityType.FIREBALL);
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
int i;
|
||||
|
||||
public void run()
|
||||
{
|
||||
if (fireball.isValid() && IsLive())
|
||||
{
|
||||
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, fireball.getLocation(), 0.3F, 0.3F, 0.3F, 0, 3);
|
||||
|
||||
if (i++ % 6 == 0)
|
||||
{
|
||||
fireball.getWorld().playSound(fireball.getLocation(), Sound.CAT_HISS, 1.6F, 0F);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(getArcadeManager().GetPlugin(), 0, 0);
|
||||
|
||||
vector.normalize().multiply(-0.05);
|
||||
|
||||
while (loc.getY() > player.getLocation().getY())
|
||||
{
|
||||
UtilParticle.PlayParticle(ParticleType.FLAME, loc, 0, 0, 0, 0, 1);
|
||||
loc.add(vector);
|
||||
}
|
||||
|
||||
// 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.setYield(3.5F);
|
||||
fireball.setIsIncendiary(true);
|
||||
fireball.setFireTicks(9999);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ScoreboardUpdate(UpdateEvent event)
|
||||
{
|
||||
GetScoreboard().Reset();
|
||||
|
||||
GetScoreboard().Write(C.cGold + C.Bold + "Wizards");
|
||||
GetScoreboard().Write(C.cYellow + GetPlayers(true).size());
|
||||
GetScoreboard().WriteBlank();
|
||||
|
||||
GetScoreboard().Write(C.cYellow + C.Bold + "Wizards");
|
||||
GetScoreboard().Write(C.cWhite + GetPlayers(true).size());
|
||||
|
||||
GetScoreboard().WriteBlank();
|
||||
|
||||
GetScoreboard().Write(C.cYellow + C.Bold + "Time Left");
|
||||
GetScoreboard().Write(
|
||||
C.cWhite
|
||||
+ UtilTime.convertString(
|
||||
IsLive() ? Math.max(0, (getGameLiveTime() + (0 * 60 * 1000)) - System.currentTimeMillis())
|
||||
: (0 * 60 * 1000), 1, TimeUnit.MINUTES));
|
||||
|
||||
GetScoreboard().Draw();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ public class WizardSpellMenu extends MiniPlugin
|
||||
{
|
||||
|
||||
Player p = event.getPlayer();
|
||||
if (event.getAction().name().contains("LEFT") && p.getInventory().getHeldItemSlot() < 5)
|
||||
if (event.getAction().name().contains("RIGHT") && p.getInventory().getHeldItemSlot() < 5)
|
||||
{
|
||||
|
||||
_wizardShop.attemptShopOpen(p);
|
||||
|
@ -2,7 +2,7 @@ package nautilus.game.arcade.game.games.wizards.spellinterfaces;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public interface SpellRightClick
|
||||
public interface SpellClick
|
||||
{
|
||||
public void castSpell(Player player);
|
||||
}
|
@ -3,7 +3,7 @@ package nautilus.game.arcade.game.games.wizards.spellinterfaces;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public interface SpellRightClickBlock
|
||||
public interface SpellClickBlock
|
||||
{
|
||||
public void castSpell(Player player, Block block);
|
||||
}
|
@ -3,7 +3,7 @@ package nautilus.game.arcade.game.games.wizards.spellinterfaces;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public interface SpellRightClickEntity
|
||||
public interface SpellClickEntity
|
||||
{
|
||||
public void castSpell(Player player, Entity entity);
|
||||
}
|
@ -3,7 +3,7 @@ package nautilus.game.arcade.game.games.wizards.spells;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilShapes;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellRightClickBlock;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClickBlock;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Material;
|
||||
@ -12,7 +12,7 @@ import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class SpellBridge extends Spell implements SpellRightClickBlock
|
||||
public class SpellBridge extends Spell implements SpellClickBlock
|
||||
{
|
||||
final BlockFace[] radial =
|
||||
{
|
||||
|
@ -7,9 +7,9 @@ import org.bukkit.entity.Player;
|
||||
import mineplex.core.common.util.C;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.Wizard;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellRightClickEntity;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClickEntity;
|
||||
|
||||
public class SpellDrain extends Spell implements SpellRightClickEntity
|
||||
public class SpellDrain extends Spell implements SpellClickEntity
|
||||
{
|
||||
|
||||
@Override
|
||||
|
@ -5,7 +5,7 @@ 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.SpellRightClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -18,7 +18,7 @@ import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
public class SpellDroom extends Spell implements SpellRightClick
|
||||
public class SpellDroom extends Spell implements SpellClick
|
||||
{
|
||||
private ArrayList<FallingBlock> _fallingBlocks = new ArrayList<FallingBlock>();
|
||||
|
||||
@ -38,6 +38,7 @@ public class SpellDroom extends Spell implements SpellRightClick
|
||||
}
|
||||
|
||||
ArrayList<FallingBlock> newFallingBlocks = new ArrayList<FallingBlock>();
|
||||
|
||||
for (Player p : players)
|
||||
{
|
||||
Location loc = p.getLocation().clone().add(0, 15 + (getSpellLevel(player) * 3), 0);
|
||||
@ -54,10 +55,14 @@ public class SpellDroom extends Spell implements SpellRightClick
|
||||
|
||||
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, 2, 0);
|
||||
|
||||
anvil.getWorld().playSound(anvil.getLocation(), Sound.ANVIL_USE, 1.9F, 0);
|
||||
|
||||
newFallingBlocks.add(anvil);
|
||||
|
||||
}
|
||||
@ -75,9 +80,14 @@ public class SpellDroom extends Spell implements SpellRightClick
|
||||
{
|
||||
_fallingBlocks.remove(entity);
|
||||
|
||||
new CustomExplosion(Wizards.getArcadeManager().GetDamage(), entity.getLocation(), (float) entity
|
||||
.getMetadata("ExplosionSize").get(0).asDouble(), (Player) entity.getMetadata("Wizard").get(0).value(), "Droom",
|
||||
true);
|
||||
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();
|
||||
}
|
||||
|
@ -14,10 +14,10 @@ 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.SpellRightClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spells.subclasses.ExplosiveRune;
|
||||
|
||||
public class SpellExplosiveRune extends Spell implements SpellRightClick
|
||||
public class SpellExplosiveRune extends Spell implements SpellClick
|
||||
{
|
||||
private ArrayList<ExplosiveRune> _explosiveRunes = new ArrayList<ExplosiveRune>();
|
||||
|
||||
|
@ -10,9 +10,9 @@ import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
import mineplex.minecraft.game.core.explosion.CustomExplosion;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellRightClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
|
||||
public class SpellFireball extends Spell implements SpellRightClick
|
||||
public class SpellFireball extends Spell implements SpellClick
|
||||
{
|
||||
|
||||
@EventHandler
|
||||
@ -22,9 +22,15 @@ public class SpellFireball extends Spell implements SpellRightClick
|
||||
if (projectile.hasMetadata("FireballSpell"))
|
||||
{
|
||||
projectile.remove();
|
||||
new CustomExplosion(Wizards.getArcadeManager().GetDamage(), projectile.getLocation(),
|
||||
((org.bukkit.entity.Fireball) projectile).getYield(), (Player) projectile.getMetadata("FireballSpell").get(0)
|
||||
.value(), "Fireball", true);
|
||||
|
||||
CustomExplosion explosion = new CustomExplosion(Wizards.getArcadeManager().GetDamage(), projectile.getLocation(),
|
||||
((org.bukkit.entity.Fireball) projectile).getYield(), "Fireball");
|
||||
|
||||
explosion.setPlayer((Player) projectile.getMetadata("FireballSpell").get(0).value(), true);
|
||||
|
||||
explosion.setDropItems(false);
|
||||
|
||||
explosion.explode();
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,11 +39,15 @@ public class SpellFireball extends Spell implements SpellRightClick
|
||||
{
|
||||
org.bukkit.entity.Fireball fireball = (org.bukkit.entity.Fireball) p.getWorld().spawnEntity(p.getEyeLocation(),
|
||||
EntityType.FIREBALL);
|
||||
|
||||
fireball.setVelocity(p.getEyeLocation().getDirection());
|
||||
fireball.setBounce(false);
|
||||
fireball.setDirection(fireball.getVelocity());
|
||||
fireball.setShooter(p);
|
||||
p.getWorld().playSound(p.getLocation(), Sound.BLAZE_BREATH, 0.5F, 5F);
|
||||
fireball.setYield(getSpellLevel(p) * 0.8F);
|
||||
fireball.setYield((getSpellLevel(p) * 0.5F) + 0.5F);
|
||||
fireball.setMetadata("FireballSpell", new FixedMetadataValue(Wizards.getArcadeManager().GetPlugin(), p));
|
||||
|
||||
p.getWorld().playSound(p.getLocation(), Sound.BLAZE_BREATH, 0.5F, 5F);
|
||||
charge(p);
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ import java.util.List;
|
||||
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellRightClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
@ -13,7 +13,7 @@ import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class SpellFlash extends Spell implements SpellRightClick
|
||||
public class SpellFlash extends Spell implements SpellClick
|
||||
{
|
||||
@Override
|
||||
public void castSpell(Player player)
|
||||
|
@ -1,15 +1,15 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellRightClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellRightClickEntity;
|
||||
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 SpellRightClick, SpellRightClickEntity
|
||||
public class SpellHeal extends Spell implements SpellClick, SpellClickEntity
|
||||
{
|
||||
|
||||
@Override
|
||||
|
@ -14,10 +14,10 @@ import org.bukkit.event.EventHandler;
|
||||
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.SpellRightClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spells.subclasses.HealingRune;
|
||||
|
||||
public class SpellHealingRune extends Spell implements SpellRightClick
|
||||
public class SpellHealingRune extends Spell implements SpellClick
|
||||
{
|
||||
private ArrayList<HealingRune> _healingRunes = new ArrayList<HealingRune>();
|
||||
|
||||
|
@ -8,14 +8,16 @@ import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.ContainerBlock;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellRightClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
|
||||
public class SpellImplode extends Spell implements SpellRightClick
|
||||
public class SpellImplode extends Spell implements SpellClick
|
||||
{
|
||||
|
||||
@Override
|
||||
@ -42,6 +44,21 @@ public class SpellImplode extends Spell implements SpellRightClick
|
||||
Location centerLocation = centerBlock.getLocation().clone().add(0.5, 0.5, 0.5);
|
||||
int size = getSpellLevel(p);
|
||||
|
||||
/* for (Entity entity : centerLocation.getWorld().getEntities())
|
||||
{
|
||||
if (!(entity instanceof Player) || Wizards.IsAlive(entity))
|
||||
{
|
||||
Location loc = entity.getLocation();
|
||||
|
||||
if (loc.distance(centerLocation) <= size * 2)
|
||||
{
|
||||
entity.setVelocity(centerLocation.toVector().subtract(loc.toVector()).normalize()
|
||||
.multiply((size * 2D) / Math.max(1, loc.distance(centerLocation))));
|
||||
entity.setFallDistance(-2);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
for (int x = -size * 2; x <= size * 2; x++)
|
||||
{
|
||||
for (int y = -size; y <= size; y++)
|
||||
@ -51,7 +68,7 @@ public class SpellImplode extends Spell implements SpellRightClick
|
||||
Block effectedBlock = centerBlock.getRelative(x, y, z);
|
||||
|
||||
if (effectedBlock.getLocation().distance(centerBlock.getLocation()) <= size * 2
|
||||
&& !(effectedBlock.getState() instanceof ContainerBlock))
|
||||
&& !(effectedBlock.getState() instanceof InventoryHolder))
|
||||
{
|
||||
FallingBlock block = effectedBlock.getWorld().spawnFallingBlock(effectedBlock.getLocation(),
|
||||
effectedBlock.getType(), effectedBlock.getData());
|
||||
@ -70,5 +87,4 @@ public class SpellImplode extends Spell implements SpellRightClick
|
||||
charge(p);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,9 +17,9 @@ 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.SpellRightClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
|
||||
public class SpellLance extends Spell implements SpellRightClick
|
||||
public class SpellLance extends Spell implements SpellClick
|
||||
{
|
||||
private ArrayList<Entry<ArrayList<Location>, Player>> _locations = new ArrayList<Entry<ArrayList<Location>, Player>>();
|
||||
|
||||
@ -89,6 +89,12 @@ public class SpellLance extends Spell implements SpellRightClick
|
||||
|
||||
private void explode(Location loc, Player player)
|
||||
{
|
||||
new CustomExplosion(Wizards.getArcadeManager().GetDamage(), loc, 1.2F, player, "Lance", false);
|
||||
CustomExplosion explosion = new CustomExplosion(Wizards.getArcadeManager().GetDamage(), loc, 1.2F, "Lance");
|
||||
|
||||
explosion.setPlayer(player, false);
|
||||
|
||||
explosion.setDropItems(false);
|
||||
|
||||
explosion.explode();
|
||||
}
|
||||
}
|
||||
|
@ -15,10 +15,10 @@ 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.SpellRightClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spells.subclasses.LaunchRune;
|
||||
|
||||
public class SpellLaunchRune extends Spell implements SpellRightClick
|
||||
public class SpellLaunchRune extends Spell implements SpellClick
|
||||
{
|
||||
private ArrayList<LaunchRune> _launchRunes = new ArrayList<LaunchRune>();
|
||||
|
||||
|
@ -2,7 +2,9 @@ package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.LightningStrike;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -13,9 +15,9 @@ import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellRightClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
|
||||
public class SpellLightningStrike extends Spell implements SpellRightClick
|
||||
public class SpellLightningStrike extends Spell implements SpellClick
|
||||
{
|
||||
|
||||
@Override
|
||||
@ -24,8 +26,14 @@ public class SpellLightningStrike extends Spell implements SpellRightClick
|
||||
List<Block> list = p.getLastTwoTargetBlocks(UtilBlock.blockAirFoliageSet, 150);
|
||||
if (list.size() > 1)
|
||||
{
|
||||
LightningStrike lightning = p.getWorld().strikeLightning(
|
||||
p.getWorld().getHighestBlockAt(list.get(0).getLocation()).getLocation());
|
||||
Location loc = list.get(0).getLocation();
|
||||
|
||||
while (UtilBlock.solid(loc.getBlock().getRelative(BlockFace.UP)))
|
||||
{
|
||||
loc.add(0, 1, 0);
|
||||
}
|
||||
|
||||
LightningStrike lightning = p.getWorld().strikeLightning(loc);
|
||||
|
||||
lightning.setMetadata("Damager", new FixedMetadataValue(Wizards.getArcadeManager().GetPlugin(), p));
|
||||
|
||||
|
@ -14,9 +14,9 @@ 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.SpellRightClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
|
||||
public class SpellMagicMissile extends Spell implements SpellRightClick
|
||||
public class SpellMagicMissile extends Spell implements SpellClick
|
||||
{
|
||||
|
||||
public void castSpell(final Player player)
|
||||
@ -42,14 +42,18 @@ public class SpellMagicMissile extends Spell implements SpellRightClick
|
||||
|
||||
Location eLoc = entity.getLocation();
|
||||
|
||||
if (eLoc.clone().add(0, loc.getY() - eLoc.getY(), 0).distance(loc) <= 0.6
|
||||
&& Math.abs((eLoc.getY() + (entity.getEyeHeight() / 1.8)) - loc.getY()) <= entity.getEyeHeight() / 2)
|
||||
// If they are less than 0.5 blocks away
|
||||
if (eLoc.clone().add(0, loc.getY() - eLoc.getY(), 0).distance(loc) <= 0.7)
|
||||
{
|
||||
|
||||
if (entity != player && (!(entity instanceof Player) || Wizards.IsAlive(entity)))
|
||||
// If it is in their body height
|
||||
if (Math.abs((eLoc.getY() + (entity.getEyeHeight() / 1.5)) - loc.getY()) <= entity.getEyeHeight() / 2)
|
||||
{
|
||||
Wizards.Manager.GetDamage().NewDamageEvent(entity, player, null, DamageCause.CUSTOM, damage, true,
|
||||
true, false, "Magic Missile", "Magic Missile");
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -83,10 +87,10 @@ public class SpellMagicMissile extends Spell implements SpellRightClick
|
||||
Location eLoc = ent.getLocation();
|
||||
|
||||
// If they are less than 0.5 blocks away
|
||||
if (eLoc.clone().add(0, loc.getY() - eLoc.getY(), 0).distance(loc) <= 0.5)
|
||||
if (eLoc.clone().add(0, loc.getY() - eLoc.getY(), 0).distance(loc) <= 0.7)
|
||||
{
|
||||
// If it is in their body height
|
||||
if (Math.abs((eLoc.getY() + (ent.getEyeHeight() / 1.7)) - loc.getY()) <= ent.getEyeHeight() / 2)
|
||||
if (Math.abs((eLoc.getY() + (ent.getEyeHeight() / 1.5)) - loc.getY()) <= ent.getEyeHeight() / 2)
|
||||
{
|
||||
burst();
|
||||
// entities.add(ent);
|
||||
|
@ -4,7 +4,7 @@ import mineplex.core.common.util.UtilBlock;
|
||||
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.SpellRightClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
@ -14,13 +14,13 @@ import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
public class SpellRainbowBeam extends Spell implements SpellRightClick
|
||||
public class SpellRainbowBeam extends Spell implements SpellClick
|
||||
{
|
||||
|
||||
@Override
|
||||
public void castSpell(Player p)
|
||||
{
|
||||
Entity entityTarget = UtilPlayer.getEntityInSight(p, 20 * getSpellLevel(p), true, true, true);
|
||||
Entity entityTarget = UtilPlayer.getEntityInSight(p, 20 * getSpellLevel(p), true, true, true, 1.5F);
|
||||
|
||||
if (!(entityTarget instanceof LivingEntity))
|
||||
{
|
||||
@ -34,11 +34,13 @@ public class SpellRainbowBeam extends Spell implements SpellRightClick
|
||||
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) * 1.5F, true,
|
||||
.NewDamageEvent((LivingEntity) entityTarget, p, null, DamageCause.CUSTOM, (getSpellLevel(p) * 2) + 4F, true,
|
||||
true, false, "Rainbow Beam", "Rainbow Beam");
|
||||
|
||||
p.playSound(entityTarget.getLocation(), Sound.LEVEL_UP, (getSpellLevel(p) * 2) + 5, 1);
|
||||
|
||||
}
|
||||
|
@ -1,9 +1,11 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilShapes;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellRightClickBlock;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClickBlock;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
@ -15,7 +17,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class SpellRumble extends Spell implements SpellRightClickBlock
|
||||
public class SpellRumble extends Spell implements SpellClickBlock
|
||||
{
|
||||
|
||||
final private BlockFace[] _radial =
|
||||
@ -28,18 +30,18 @@ public class SpellRumble extends Spell implements SpellRightClickBlock
|
||||
public void castSpell(final Player player, final Block target)
|
||||
{
|
||||
final BlockFace facing = _radial[Math.round(player.getEyeLocation().getYaw() / 45f) & 0x7];
|
||||
final int damage = 5 + getSpellLevel(player);
|
||||
|
||||
final int damage = 7 + getSpellLevel(player);
|
||||
|
||||
if (UtilBlock.solid(target))
|
||||
{
|
||||
|
||||
|
||||
player.getWorld().playEffect(target.getLocation(), Effect.STEP_SOUND, target.getTypeId());
|
||||
final int maxDist = 10 * getSpellLevel(player);
|
||||
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
Block block = target;
|
||||
int blocks = 0;
|
||||
Block currentBlock = target;
|
||||
int distTravelled = 0;
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
@ -49,75 +51,81 @@ public class SpellRumble extends Spell implements SpellRightClickBlock
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
block = block.getRelative(facing);
|
||||
if (UtilBlock.solid(block.getRelative(BlockFace.UP)))
|
||||
|
||||
currentBlock = currentBlock.getRelative(facing);
|
||||
if (UtilBlock.solid(currentBlock.getRelative(BlockFace.UP)))
|
||||
{
|
||||
|
||||
block = block.getRelative(BlockFace.UP);
|
||||
if (UtilBlock.solid(block.getRelative(BlockFace.UP)))
|
||||
|
||||
currentBlock = currentBlock.getRelative(BlockFace.UP);
|
||||
if (UtilBlock.solid(currentBlock.getRelative(BlockFace.UP)))
|
||||
{
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if (!UtilBlock.solid(block))
|
||||
else if (!UtilBlock.solid(currentBlock))
|
||||
{
|
||||
|
||||
block = block.getRelative(BlockFace.DOWN);
|
||||
if (!UtilBlock.solid(block))
|
||||
|
||||
currentBlock = currentBlock.getRelative(BlockFace.DOWN);
|
||||
if (!UtilBlock.solid(currentBlock))
|
||||
{
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Block bs[] = UtilShapes.getSideBlocks(block, facing);
|
||||
bs = new Block[]
|
||||
{
|
||||
bs[0], bs[1], block
|
||||
};
|
||||
|
||||
|
||||
BlockFace[] faces = UtilShapes.getSideBlockFaces(currentBlock, facing);
|
||||
|
||||
ArrayList<Block> bs = new ArrayList<Block>();
|
||||
|
||||
bs.add(currentBlock);
|
||||
|
||||
for (int i = 1; i <= Math.max(1, Math.floor(distTravelled / 7D)) + 1; i++)
|
||||
{
|
||||
bs.add(currentBlock.getRelative(faces[0], i));
|
||||
bs.add(currentBlock.getRelative(faces[1], i));
|
||||
}
|
||||
|
||||
for (Block b : bs)
|
||||
{
|
||||
for (Entity entity : b.getChunk().getEntities())
|
||||
{
|
||||
if (entity instanceof LivingEntity && player != entity)
|
||||
{
|
||||
|
||||
|
||||
if (entity instanceof Player && !Wizards.IsAlive(entity))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Location loc = entity.getLocation();
|
||||
|
||||
|
||||
if (loc.getBlockX() == b.getX() && loc.getBlockZ() == b.getZ())
|
||||
{
|
||||
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, b.getTypeId());
|
||||
}
|
||||
|
||||
if (blocks++ >= maxDist)
|
||||
|
||||
if (distTravelled++ >= maxDist)
|
||||
{
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(Wizards.getArcadeManager().GetPlugin(), 5, 1);
|
||||
|
||||
|
||||
charge(player);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,18 +1,18 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellRightClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
public class SpellSpeedBoost extends Spell implements SpellRightClick
|
||||
public class SpellSpeedBoost extends Spell implements SpellClick
|
||||
{
|
||||
@Override
|
||||
public void castSpell(Player p)
|
||||
{
|
||||
int ticks = (20 * 90) * getSpellLevel(p);
|
||||
int ticks = 30 * getSpellLevel(p) * 20;
|
||||
int potionLevel = getSpellLevel(p);
|
||||
|
||||
p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, ticks, potionLevel), true);
|
||||
|
@ -7,9 +7,9 @@ import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellRightClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
|
||||
public class SpellSpiderman extends Spell implements SpellRightClick
|
||||
public class SpellSpiderman extends Spell implements SpellClick
|
||||
{
|
||||
|
||||
@Override
|
||||
|
@ -1,18 +1,47 @@
|
||||
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.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.SpellRightClickBlock;
|
||||
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.block.BlockState;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class SpellStoneWall extends Spell implements SpellRightClickBlock
|
||||
public class SpellStoneWall extends Spell implements SpellClickBlock
|
||||
{
|
||||
private HashMap<BlockState, Long> _wallExpires = new HashMap<BlockState, Long>();
|
||||
|
||||
@EventHandler
|
||||
public void onUpdate(UpdateEvent event)
|
||||
{
|
||||
Iterator<Entry<BlockState, Long>> itel = _wallExpires.entrySet().iterator();
|
||||
|
||||
while (itel.hasNext())
|
||||
{
|
||||
Entry<BlockState, Long> entry = itel.next();
|
||||
if (entry.getValue() < System.currentTimeMillis())
|
||||
{
|
||||
itel.remove();
|
||||
|
||||
if (entry.getKey().equals(entry.getKey().getBlock()))
|
||||
{
|
||||
entry.getKey().getBlock().setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void castSpell(Player player, Block obj)
|
||||
@ -21,7 +50,7 @@ public class SpellStoneWall extends Spell implements SpellRightClickBlock
|
||||
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;
|
||||
@ -30,29 +59,32 @@ public class SpellStoneWall extends Spell implements SpellRightClickBlock
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
|
||||
|
||||
currentRun++;
|
||||
BlockFace[] faces = UtilShapes.getCornerBlockFaces(block, facing);
|
||||
|
||||
|
||||
if (block.getType() == Material.AIR)
|
||||
block.setType(Material.STONE);
|
||||
|
||||
|
||||
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 (b.getType() != Material.AIR)
|
||||
break;
|
||||
|
||||
b.setType(Material.STONE);
|
||||
b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, b.getTypeId());
|
||||
|
||||
|
||||
_wallExpires.put(b.getState(), System.currentTimeMillis() + ((20 + UtilMath.r(30)) * 1000L));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
block = block.getRelative(BlockFace.UP);
|
||||
if (currentRun >= wallHeight)
|
||||
{
|
||||
@ -60,7 +92,7 @@ public class SpellStoneWall extends Spell implements SpellRightClickBlock
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(Wizards.getArcadeManager().GetPlugin(), 0, 5);
|
||||
|
||||
|
||||
charge(player);
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
@ -24,10 +25,10 @@ import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
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.SpellRightClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellRightClickBlock;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClickBlock;
|
||||
|
||||
public class SpellSummonWolves extends Spell implements SpellRightClick, SpellRightClickBlock
|
||||
public class SpellSummonWolves extends Spell implements SpellClick, SpellClickBlock
|
||||
{
|
||||
|
||||
private HashMap<Wolf, Long> _summonedWolves = new HashMap<Wolf, Long>();
|
||||
@ -46,18 +47,24 @@ public class SpellSummonWolves extends Spell implements SpellRightClick, SpellRi
|
||||
|
||||
for (int i = 0; i < 2 + getSpellLevel(player); i++)
|
||||
{
|
||||
Wizards.CreatureAllowOverride = true;
|
||||
|
||||
Wolf wolf = (Wolf) player.getWorld().spawnEntity(loc, EntityType.WOLF);
|
||||
|
||||
Wizards.CreatureAllowOverride = false;
|
||||
|
||||
wolf.setCollarColor(DyeColor.YELLOW);
|
||||
wolf.setTamed(true);
|
||||
wolf.setOwner(player);
|
||||
wolf.setBreed(false);
|
||||
wolf.setCustomName(player.getCustomName() + "'s Summoned Wolf");
|
||||
wolf.setCustomName(player.getDisplayName() + "'s Summoned Wolf");
|
||||
wolf.setCustomNameVisible(true);
|
||||
wolf.setRemoveWhenFarAway(false);
|
||||
wolf.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 9001, 1));
|
||||
wolf.setMaxHealth(wolf.getMaxHealth() / 2);
|
||||
wolf.setHealth(wolf.getMaxHealth());
|
||||
// wolf.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 9001, 0));
|
||||
|
||||
this._summonedWolves.put(wolf, System.currentTimeMillis() + (180L * 1000L));
|
||||
this._summonedWolves.put(wolf, System.currentTimeMillis() + (60L * 1000L));
|
||||
}
|
||||
|
||||
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, loc, 0.8F, 0, 0.8F, 0, 4);
|
||||
@ -81,6 +88,11 @@ public class SpellSummonWolves extends Spell implements SpellRightClick, SpellRi
|
||||
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);
|
||||
}
|
||||
|
||||
wolf.remove();
|
||||
itel.remove();
|
||||
}
|
||||
@ -114,6 +126,15 @@ public class SpellSummonWolves extends Spell implements SpellRightClick, SpellRi
|
||||
{
|
||||
wolf.setTarget(target);
|
||||
}
|
||||
else
|
||||
{
|
||||
Location loc = ((Player) wolfOwner).getLocation();
|
||||
|
||||
if (loc.distance(wolf.getLocation()) > 16)
|
||||
{
|
||||
wolf.teleport(loc);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -11,13 +11,14 @@ import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
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.SpellRightClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spells.subclasses.TeleportRune;
|
||||
|
||||
public class SpellTeleportRune extends Spell implements SpellRightClick
|
||||
public class SpellTeleportRune extends Spell implements SpellClick
|
||||
{
|
||||
private ArrayList<TeleportRune> _teleportRunes = new ArrayList<TeleportRune>();
|
||||
|
||||
@ -57,6 +58,15 @@ public class SpellTeleportRune extends Spell implements SpellRightClick
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
TeleportRune teleportRune = new TeleportRune(firstTeleport, secondTeleport, getSpellLevel(player));
|
||||
|
@ -21,10 +21,10 @@ 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.SpellRightClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spells.subclasses.TrapRune;
|
||||
|
||||
public class SpellTrapRune extends Spell implements SpellRightClick
|
||||
public class SpellTrapRune extends Spell implements SpellClick
|
||||
{
|
||||
private ArrayList<TrapRune> _runes = new ArrayList<TrapRune>();
|
||||
|
||||
@ -155,8 +155,14 @@ public class SpellTrapRune extends Spell implements SpellRightClick
|
||||
{
|
||||
rune.RuneLocation.getWorld().playSound(rune.RuneLocation, Sound.WITHER_SHOOT, 5, (float) rune.RuneSize * 2);
|
||||
|
||||
new CustomExplosion(Wizards.getArcadeManager().GetDamage(), rune.RuneLocation.clone().add(0, 0.3, 0),
|
||||
(float) rune.RuneSize * 1.2F, rune.RuneCaster, "Trap Rune", true);
|
||||
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))
|
||||
{
|
||||
|
@ -3,9 +3,9 @@ package nautilus.game.arcade.game.games.wizards.spells;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellRightClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
|
||||
public class SpellTunnel extends Spell implements SpellRightClick
|
||||
public class SpellTunnel extends Spell implements SpellClick
|
||||
{
|
||||
|
||||
@Override
|
||||
|
@ -7,9 +7,9 @@ import org.bukkit.entity.Player;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilShapes;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellRightClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
|
||||
public class SpellWizardsCompass extends Spell implements SpellRightClick
|
||||
public class SpellWizardsCompass extends Spell implements SpellClick
|
||||
{
|
||||
|
||||
@Override
|
||||
|
@ -23,7 +23,13 @@ public class ExplosiveRune
|
||||
|
||||
if (_ticksTillExplode <= 0)
|
||||
{
|
||||
new CustomExplosion(_damageManager, _explosiveLocation, _explosiveSize, _explosiveOwner, "Explosive Rune", true);
|
||||
CustomExplosion explosion = new CustomExplosion(_damageManager, _explosiveLocation, _explosiveSize, "Explosive Rune");
|
||||
|
||||
explosion.setPlayer(_explosiveOwner, true);
|
||||
|
||||
explosion.setDropItems(false);
|
||||
|
||||
explosion.explode();
|
||||
|
||||
drawBoxParticles();
|
||||
return true;
|
||||
|
@ -6,9 +6,12 @@ import java.util.UUID;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilShapes;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
|
||||
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
|
||||
@ -28,29 +31,34 @@ public class LaunchRune
|
||||
{
|
||||
for (LivingEntity entity : _runeLocation.getWorld().getEntitiesByClass(LivingEntity.class))
|
||||
{
|
||||
UUID uuid = entity.getUniqueId();
|
||||
|
||||
if (!_launchedEntities.containsKey(uuid) || _launchedEntities.get(uuid) < System.currentTimeMillis())
|
||||
if (!(entity instanceof Player) || ((Player) entity).getGameMode() != GameMode.CREATIVE)
|
||||
{
|
||||
|
||||
Location loc = entity.getLocation();
|
||||
UUID uuid = entity.getUniqueId();
|
||||
|
||||
if (loc.getY() >= _runeLocation.getY() && loc.getY() <= _runeLocation.getY() + 1)
|
||||
if (!_launchedEntities.containsKey(uuid) || _launchedEntities.get(uuid) < System.currentTimeMillis())
|
||||
{
|
||||
|
||||
loc.setY(_runeLocation.getY());
|
||||
Location loc = entity.getLocation();
|
||||
|
||||
if (loc.distance(_runeLocation) <= _runeSize)
|
||||
if (loc.getY() >= _runeLocation.getY() && loc.getY() <= _runeLocation.getY() + 1)
|
||||
{
|
||||
|
||||
Vector vector = entity.getLocation().getDirection().normalize().multiply(0.1);
|
||||
vector.setY(_launchHeight);
|
||||
entity.setVelocity(vector);
|
||||
entity.setFallDistance(0);
|
||||
loc.setY(_runeLocation.getY());
|
||||
|
||||
launched = true;
|
||||
if (loc.distance(_runeLocation) <= _runeSize)
|
||||
{
|
||||
|
||||
_launchedEntities.put(uuid, System.currentTimeMillis() + (long) (_runeSize * 2500L));
|
||||
Vector vector = entity.getLocation().getDirection().normalize().multiply(0.1);
|
||||
vector.setY(_launchHeight);
|
||||
entity.setVelocity(vector);
|
||||
entity.setFallDistance(0);
|
||||
|
||||
launched = true;
|
||||
|
||||
_launchedEntities.put(uuid, System.currentTimeMillis() + (long) (_runeSize * 2500L));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -42,8 +42,8 @@ public class TeleportRune
|
||||
{
|
||||
if (_ticksLived % 40 == 0)
|
||||
{
|
||||
_firstLoc.getWorld().playSound(_firstLoc, Sound.PORTAL, (float) Math.min(3, _runeSize), 0F);
|
||||
_firstLoc.getWorld().playSound(_secondLoc, Sound.PORTAL, (float) Math.min(3, _runeSize), 0F);
|
||||
_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))
|
||||
|
Loading…
Reference in New Issue
Block a user