Decoreability cleanup

This commit is contained in:
nathank33 2015-11-11 15:22:27 -08:00
parent e84b239665
commit 29873e139a
33 changed files with 400 additions and 284 deletions

View file

@ -31,6 +31,7 @@ import com.projectkorra.projectkorra.util.Flight;
public class AirBlast implements ConfigLoadable { public class AirBlast implements ConfigLoadable {
public static ConcurrentHashMap<Integer, AirBlast> instances = new ConcurrentHashMap<>(); public static ConcurrentHashMap<Integer, AirBlast> instances = new ConcurrentHashMap<>();
private static ConcurrentHashMap<Player, Location> origins = new ConcurrentHashMap<Player, Location>(); private static ConcurrentHashMap<Player, Location> origins = new ConcurrentHashMap<Player, Location>();
public static double speed = config.get().getDouble("Abilities.Air.AirBlast.Speed"); public static double speed = config.get().getDouble("Abilities.Air.AirBlast.Speed");

View file

@ -16,7 +16,9 @@ import com.projectkorra.projectkorra.waterbending.WaterManipulation;
import com.projectkorra.projectkorra.waterbending.WaterMethods; import com.projectkorra.projectkorra.waterbending.WaterMethods;
public class AirBubble implements ConfigLoadable { public class AirBubble implements ConfigLoadable {
public static final ConcurrentHashMap<Player, AirBubble> instances = new ConcurrentHashMap<>();
public static ConcurrentHashMap<Player, AirBubble> instances = new ConcurrentHashMap<>();
private static double DEFAULT_AIR_RADIUS = config.get().getDouble("Abilities.Air.AirBubble.Radius"); private static double DEFAULT_AIR_RADIUS = config.get().getDouble("Abilities.Air.AirBubble.Radius");
private static double DEFAULT_WATER_RADIUS = config.get().getDouble("Abilities.Water.WaterBubble.Radius"); private static double DEFAULT_WATER_RADIUS = config.get().getDouble("Abilities.Water.WaterBubble.Radius");
@ -53,7 +55,7 @@ public class AirBubble implements ConfigLoadable {
if (GeneralMethods.getBoundAbility(player) != null) { if (GeneralMethods.getBoundAbility(player) != null) {
if (GeneralMethods.getBoundAbility(player).equalsIgnoreCase("AirBubble") if (GeneralMethods.getBoundAbility(player).equalsIgnoreCase("AirBubble")
|| GeneralMethods.getBoundAbility(player).equalsIgnoreCase("WaterBubble")) { || GeneralMethods.getBoundAbility(player).equalsIgnoreCase("WaterBubble")) {
if (instances.containsKey(player) && player.isSneaking()) { if (!instances.containsKey(player) && player.isSneaking()) {
new AirBubble(player); new AirBubble(player);
} }
} }

View file

@ -17,7 +17,8 @@ import com.projectkorra.projectkorra.configuration.ConfigLoadable;
public class AirBurst implements ConfigLoadable { public class AirBurst implements ConfigLoadable {
public static final ConcurrentHashMap<Player, AirBurst> instances = new ConcurrentHashMap<>(); public static ConcurrentHashMap<Player, AirBurst> instances = new ConcurrentHashMap<>();
private static double PARTICLES_PERCENTAGE = 50; private static double PARTICLES_PERCENTAGE = 50;
private static double threshold = config.get().getDouble("Abilities.Air.AirBurst.FallThreshold"); private static double threshold = config.get().getDouble("Abilities.Air.AirBurst.FallThreshold");

View file

@ -25,6 +25,7 @@ import org.bukkit.util.Vector;
import java.util.ArrayList; import java.util.ArrayList;
public class AirCombo implements ConfigLoadable { public class AirCombo implements ConfigLoadable {
public static enum AbilityState { public static enum AbilityState {
TWISTER_MOVING, TWISTER_STATIONARY TWISTER_MOVING, TWISTER_STATIONARY
} }
@ -304,7 +305,8 @@ public class AirCombo implements ConfigLoadable {
direction = player.getEyeLocation().getDirection(); direction = player.getEyeLocation().getDirection();
for (double i = -5; i < 10; i += 1) { for (double i = -5; i < 10; i += 1) {
FireComboStream fs = new FireComboStream(null, direction.clone().add(new Vector(0, 0.03 * i, 0)), player.getLocation(), range, speed, "AirSlice"); FireComboStream fs = new FireComboStream(null, direction.clone().add(new Vector(0, 0.03 * i, 0)),
player.getLocation(), range, speed, "AirSlice");
fs.setDensity(1); fs.setDensity(1);
fs.setSpread(0F); fs.setSpread(0F);
fs.setUseNewParticles(true); fs.setUseNewParticles(true);
@ -346,7 +348,8 @@ public class AirCombo implements ConfigLoadable {
Vector origToDest = GeneralMethods.getDirection(origin, destination); Vector origToDest = GeneralMethods.getDirection(origin, destination);
for (double i = 0; i < 30; i++) { for (double i = 0; i < 30; i++) {
Vector vec = GeneralMethods.getDirection(player.getLocation(), origin.clone().add(origToDest.clone().multiply(i / 30))); Vector vec = GeneralMethods.getDirection(player.getLocation(),
origin.clone().add(origToDest.clone().multiply(i / 30)));
FireComboStream fs = new FireComboStream(null, vec, player.getLocation(), range, speed, "AirSweep"); FireComboStream fs = new FireComboStream(null, vec, player.getLocation(), range, speed, "AirSweep");
fs.setDensity(1); fs.setDensity(1);
@ -480,7 +483,8 @@ public class AirCombo implements ConfigLoadable {
else if (ability.equalsIgnoreCase("AirSweep") && combo.ability.equalsIgnoreCase("AirSweep")) { else if (ability.equalsIgnoreCase("AirSweep") && combo.ability.equalsIgnoreCase("AirSweep")) {
for (int j = 0; j < combo.tasks.size(); j++) { for (int j = 0; j < combo.tasks.size(); j++) {
FireComboStream fs = (FireComboStream) combo.tasks.get(j); FireComboStream fs = (FireComboStream) combo.tasks.get(j);
if (fs.getLocation() != null && fs.getLocation().getWorld().equals(loc.getWorld()) && Math.abs(fs.getLocation().distance(loc)) <= radius) { if (fs.getLocation() != null && fs.getLocation().getWorld().equals(loc.getWorld())
&& Math.abs(fs.getLocation().distance(loc)) <= radius) {
fs.remove(); fs.remove();
removed = true; removed = true;
} }

View file

@ -43,8 +43,7 @@ public class AirMethods {
* Checks to see if a player can use SpiritualProjection. * Checks to see if a player can use SpiritualProjection.
* *
* @param player The player to check * @param player The player to check
* @return true If player has permission node * @return true If player has permission node "bending.air.spiritualprojection"
* "bending.air.spiritualprojection"
*/ */
public static boolean canUseSpiritualProjection(Player player) { public static boolean canUseSpiritualProjection(Player player) {
if (player.hasPermission("bending.air.spiritualprojection")) if (player.hasPermission("bending.air.spiritualprojection"))
@ -132,8 +131,8 @@ public class AirMethods {
} }
/** /**
* Plays an integer amount of air particles in a location with a given * Plays an integer amount of air particles in a location with a given xOffset, yOffset, and
* xOffset, yOffset, and zOffset. * zOffset.
* *
* @param loc The location to use * @param loc The location to use
* @param amount The amount of particles * @param amount The amount of particles
@ -185,8 +184,7 @@ public class AirMethods {
} }
/** /**
* Breaks a breathbendng hold on an entity or one a player is inflicting on * Breaks a breathbendng hold on an entity or one a player is inflicting on an entity.
* an entity.
* *
* @param entity The entity to be acted upon * @param entity The entity to be acted upon
*/ */

View file

@ -43,15 +43,21 @@ public class AirPassive implements ConfigLoadable {
if (!player.isOnline()) if (!player.isOnline())
return; return;
if (GeneralMethods.canBendPassive(player.getName(), Element.Air)) { if (GeneralMethods.canBendPassive(player.getName(), Element.Air)) {
player.setExhaustion(getExhaustion(player, player.getExhaustion())); // Handles Food Passive player.setExhaustion(getExhaustion(player, player.getExhaustion())); // Handles
// Food
// Passive
if (player.isSprinting()) { if (player.isSprinting()) {
if (!player.hasPotionEffect(PotionEffectType.SPEED)) { if (!player.hasPotionEffect(PotionEffectType.SPEED)) {
speedPower = config.get().getInt("Abilities.Air.Passive.Speed"); speedPower = config.get().getInt("Abilities.Air.Passive.Speed");
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 60, speedPower - 1)); // Handles Speed Passive player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 60, speedPower - 1)); // Handles
// Speed
// Passive
} }
if (!player.hasPotionEffect(PotionEffectType.JUMP)) { if (!player.hasPotionEffect(PotionEffectType.JUMP)) {
jumpPower = config.get().getInt("Abilities.Air.Passive.Jump"); jumpPower = config.get().getInt("Abilities.Air.Passive.Jump");
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 60, jumpPower - 1)); // Handles jump passive. player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 60, jumpPower - 1)); // Handles
// jump
// passive.
} }
} }
} }

View file

@ -16,7 +16,7 @@ import com.projectkorra.projectkorra.util.Flight;
public class AirScooter implements ConfigLoadable { public class AirScooter implements ConfigLoadable {
public static final ConcurrentHashMap<Player, AirScooter> instances = new ConcurrentHashMap<>(); public static ConcurrentHashMap<Player, AirScooter> instances = new ConcurrentHashMap<>();
private static double configSpeed = config.get().getDouble("Abilities.Air.AirScooter.Speed"); private static double configSpeed = config.get().getDouble("Abilities.Air.AirScooter.Speed");
private static final long interval = 100; private static final long interval = 100;

View file

@ -22,7 +22,7 @@ import com.projectkorra.projectkorra.firebending.FireStream;
public class AirShield implements ConfigLoadable { public class AirShield implements ConfigLoadable {
public static final ConcurrentHashMap<Player, AirShield> instances = new ConcurrentHashMap<>(); public static ConcurrentHashMap<Player, AirShield> instances = new ConcurrentHashMap<>();
private static double MAX_RADIUS = config.get().getDouble("Abilities.Air.AirShield.Radius"); private static double MAX_RADIUS = config.get().getDouble("Abilities.Air.AirShield.Radius");
private static boolean isToggle = config.get().getBoolean("Abilities.Air.AirShield.IsAvatarStateToggle"); private static boolean isToggle = config.get().getBoolean("Abilities.Air.AirShield.IsAvatarStateToggle");
@ -58,7 +58,11 @@ public class AirShield implements ConfigLoadable {
} }
public static String getDescription() { public static String getDescription() {
return "Air Shield is one of the most powerful defensive techniques in existence. " + "To use, simply sneak (default: shift). " + "This will create a whirlwind of air around the user, " + "with a small pocket of safe space in the center. " + "This wind will deflect all projectiles and will prevent any creature from " + "entering it for as long as its maintained. "; return "Air Shield is one of the most powerful defensive techniques in existence. "
+ "To use, simply sneak (default: shift). " + "This will create a whirlwind of air around the user, "
+ "with a small pocket of safe space in the center. "
+ "This wind will deflect all projectiles and will prevent any creature from "
+ "entering it for as long as its maintained. ";
} }
public static boolean isWithinShield(Location loc) { public static boolean isWithinShield(Location loc) {
@ -100,7 +104,8 @@ public class AirShield implements ConfigLoadable {
} }
if (isToggle) { if (isToggle) {
if (((!GeneralMethods.getBoundAbility(player).equalsIgnoreCase("AirShield")) || (!player.isSneaking())) && !AvatarState.isAvatarState(player)) { if (((!GeneralMethods.getBoundAbility(player).equalsIgnoreCase("AirShield")) || (!player.isSneaking()))
&& !AvatarState.isAvatarState(player)) {
remove(); remove();
return false; return false;
} }

View file

@ -14,7 +14,7 @@ import com.projectkorra.projectkorra.util.Flight;
public class AirSpout implements ConfigLoadable { public class AirSpout implements ConfigLoadable {
public static final ConcurrentHashMap<Player, AirSpout> instances = new ConcurrentHashMap<>(); public static ConcurrentHashMap<Player, AirSpout> instances = new ConcurrentHashMap<>();
private static double HEIGHT = config.get().getDouble("Abilities.Air.AirSpout.Height"); private static double HEIGHT = config.get().getDouble("Abilities.Air.AirSpout.Height");
private static final long interval = 100; private static final long interval = 100;
@ -96,7 +96,8 @@ public class AirSpout implements ConfigLoadable {
public boolean progress() { public boolean progress() {
if (!GeneralMethods.canBend(player.getName(), "AirSpout") if (!GeneralMethods.canBend(player.getName(), "AirSpout")
// || !Methods.hasAbility(player, Abilities.AirSpout) // || !Methods.hasAbility(player, Abilities.AirSpout)
|| player.getEyeLocation().getBlock().isLiquid() || GeneralMethods.isSolid(player.getEyeLocation().getBlock()) || player.isDead() || !player.isOnline()) { || player.getEyeLocation().getBlock().isLiquid() || GeneralMethods.isSolid(player.getEyeLocation().getBlock())
|| player.isDead() || !player.isOnline()) {
remove(); remove();
return false; return false;
} }
@ -177,10 +178,7 @@ public class AirSpout implements ConfigLoadable {
index = 0; index = 0;
Location effectloc2 = new Location(location.getWorld(), location.getX(), block.getY() + i, location.getZ()); Location effectloc2 = new Location(location.getWorld(), location.getX(), block.getY() + i, location.getZ());
AirMethods.playAirbendingParticles(effectloc2, 3, 0.4F, 0.4F, 0.4F); AirMethods.playAirbendingParticles(effectloc2, 3, 0.4F, 0.4F, 0.4F);
// location.getWorld().playEffect(effectloc2, Effect.SMOKE,
// (int) directions[index], (int) height + 5);
// Methods.verbose(directions[index]); // Methods.verbose(directions[index]);

View file

@ -22,7 +22,8 @@ import com.projectkorra.projectkorra.waterbending.WaterSpout;
public class AirSuction implements ConfigLoadable { public class AirSuction implements ConfigLoadable {
public static final ConcurrentHashMap<Player, AirSuction> instances = new ConcurrentHashMap<>(); public static ConcurrentHashMap<Player, AirSuction> instances = new ConcurrentHashMap<>();
private static ConcurrentHashMap<Player, Location> origins = new ConcurrentHashMap<Player, Location>(); private static ConcurrentHashMap<Player, Location> origins = new ConcurrentHashMap<Player, Location>();
private static final double maxspeed = AirBlast.maxspeed; private static final double maxspeed = AirBlast.maxspeed;

View file

@ -30,7 +30,7 @@ import com.projectkorra.projectkorra.waterbending.WaterMethods;
public class AirSwipe implements ConfigLoadable { public class AirSwipe implements ConfigLoadable {
public static final ConcurrentHashMap<Player, AirSwipe> instances = new ConcurrentHashMap<>(); public static ConcurrentHashMap<Player, AirSwipe> instances = new ConcurrentHashMap<>();
private static int stepsize = 4; private static int stepsize = 4;
@ -129,7 +129,10 @@ public class AirSwipe implements ConfigLoadable {
double radius = FireBlast.AFFECTING_RADIUS; double radius = FireBlast.AFFECTING_RADIUS;
Player source = player; Player source = player;
if (EarthBlast.annihilateBlasts(location, radius, source) || WaterManipulation.annihilateBlasts(location, radius, source) || FireBlast.annihilateBlasts(location, radius, source) || Combustion.removeAroundPoint(location, radius)) { if (EarthBlast.annihilateBlasts(location, radius, source)
|| WaterManipulation.annihilateBlasts(location, radius, source)
|| FireBlast.annihilateBlasts(location, radius, source)
|| Combustion.removeAroundPoint(location, radius)) {
elements.remove(direction); elements.remove(direction);
damage = 0; damage = 0;
remove(); remove();
@ -304,7 +307,8 @@ public class AirSwipe implements ConfigLoadable {
remove(); remove();
return false; return false;
} }
if (!GeneralMethods.getBoundAbility(player).equalsIgnoreCase("AirSwipe") || !GeneralMethods.canBend(player.getName(), "AirSwipe")) { if (!GeneralMethods.getBoundAbility(player).equalsIgnoreCase("AirSwipe")
|| !GeneralMethods.canBend(player.getName(), "AirSwipe")) {
remove(); remove();
return false; return false;
} }

View file

@ -10,7 +10,7 @@ import com.projectkorra.projectkorra.util.Flight;
public class FlightAbility implements ConfigLoadable { public class FlightAbility implements ConfigLoadable {
public static final ConcurrentHashMap<Player, FlightAbility> instances = new ConcurrentHashMap<>(); public static ConcurrentHashMap<Player, FlightAbility> instances = new ConcurrentHashMap<>();
private static ConcurrentHashMap<String, Integer> hits = new ConcurrentHashMap<String, Integer>(); private static ConcurrentHashMap<String, Integer> hits = new ConcurrentHashMap<String, Integer>();
private static ConcurrentHashMap<String, Boolean> hovering = new ConcurrentHashMap<String, Boolean>(); private static ConcurrentHashMap<String, Boolean> hovering = new ConcurrentHashMap<String, Boolean>();

View file

@ -21,15 +21,15 @@ import com.projectkorra.projectkorra.configuration.ConfigLoadable;
/** /**
* Suffocate * Suffocate
* *
* Suffocate is an air ability that causes entities to be surrounded by a sphere * Suffocate is an air ability that causes entities to be surrounded by a sphere air that causes
* air that causes constant damage after a configurable delay. Suffocate also * constant damage after a configurable delay. Suffocate also causes Blinding and Slowing affects to
* causes Blinding and Slowing affects to entities depending on how the ability * entities depending on how the ability is configured. While in AvatarState this ability can be
* is configured. While in AvatarState this ability can be used on multiple * used on multiple entities within a large radius. If the user is damaged while performing this
* entities within a large radius. If the user is damaged while performing this
* ability then the ability is removed. * ability then the ability is removed.
*/ */
public class Suffocate implements ConfigLoadable { public class Suffocate implements ConfigLoadable {
public static final ConcurrentHashMap<Player, Suffocate> instances = new ConcurrentHashMap<>();
public static ConcurrentHashMap<Player, Suffocate> instances = new ConcurrentHashMap<>();
private static boolean CAN_SUFFOCATE_UNDEAD = config.get().getBoolean("Abilities.Air.Suffocate.CanBeUsedOnUndeadMobs"); private static boolean CAN_SUFFOCATE_UNDEAD = config.get().getBoolean("Abilities.Air.Suffocate.CanBeUsedOnUndeadMobs");
private static boolean REQUIRE_CONSTANT_AIM = config.get().getBoolean("Abilities.Air.Suffocate.RequireConstantAim"); private static boolean REQUIRE_CONSTANT_AIM = config.get().getBoolean("Abilities.Air.Suffocate.RequireConstantAim");
@ -169,8 +169,7 @@ public class Suffocate implements ConfigLoadable {
} }
/** /**
* Removes an instance of Suffocate if player is the one suffocating * Removes an instance of Suffocate if player is the one suffocating entities
* entities
**/ **/
public static void remove(Player player) { public static void remove(Player player) {
if (instances.containsKey(player)) { if (instances.containsKey(player)) {
@ -185,9 +184,9 @@ public class Suffocate implements ConfigLoadable {
} }
/** /**
* Removes all instances of Suffocate at loc within the radius threshold. * Removes all instances of Suffocate at loc within the radius threshold. The location of a
* The location of a Suffocate is defined at the benders location, not the * Suffocate is defined at the benders location, not the location of the entities being
* location of the entities being suffocated. * suffocated.
* *
* @param causer The player causing this instance to be removed * @param causer The player causing this instance to be removed
**/ **/
@ -206,9 +205,8 @@ public class Suffocate implements ConfigLoadable {
} }
/** /**
* Animates this instance of the Suffocate ability. Depending on the * Animates this instance of the Suffocate ability. Depending on the specific time (dt) the
* specific time (dt) the ability will create a different set of * ability will create a different set of SuffocationSpirals.
* SuffocationSpirals.
*/ */
public void animate() { public void animate() {
long curTime = System.currentTimeMillis(); long curTime = System.currentTimeMillis();
@ -222,8 +220,10 @@ public class Suffocate implements ConfigLoadable {
for (LivingEntity lent : targets) { for (LivingEntity lent : targets) {
final LivingEntity target = lent; final LivingEntity target = lent;
if (dt < t1) { if (dt < t1) {
new SuffocateSpiral(target, steps, radius, delay, 0, 0.25 - (0.25 * (double) dt / (double) t1), 0, SpiralType.HORIZONTAL1); new SuffocateSpiral(target, steps, radius, delay, 0, 0.25 - (0.25 * (double) dt / (double) t1), 0,
new SuffocateSpiral(target, steps, radius, delay, 0, 0.25 - (0.25 * (double) dt / (double) t1), 0, SpiralType.HORIZONTAL2); SpiralType.HORIZONTAL1);
new SuffocateSpiral(target, steps, radius, delay, 0, 0.25 - (0.25 * (double) dt / (double) t1), 0,
SpiralType.HORIZONTAL2);
} else if (dt < t2) { } else if (dt < t2) {
new SuffocateSpiral(target, steps, radius, delay, 0, 0, 0, SpiralType.HORIZONTAL1); new SuffocateSpiral(target, steps, radius, delay, 0, 0, 0, SpiralType.HORIZONTAL1);
new SuffocateSpiral(target, steps * 2, radius, delay, 0, 0, 0, SpiralType.VERTICAL1); new SuffocateSpiral(target, steps * 2, radius, delay, 0, 0, 0, SpiralType.VERTICAL1);
@ -233,9 +233,15 @@ public class Suffocate implements ConfigLoadable {
new SuffocateSpiral(target, steps, radius, delay, 0, 0, 0, SpiralType.VERTICAL1); new SuffocateSpiral(target, steps, radius, delay, 0, 0, 0, SpiralType.VERTICAL1);
new SuffocateSpiral(target, steps, radius, delay, 0, 0, 0, SpiralType.VERTICAL2); new SuffocateSpiral(target, steps, radius, delay, 0, 0, 0, SpiralType.VERTICAL2);
} else if (dt < t4) { } else if (dt < t4) {
new SuffocateSpiral(target, steps, radius - Math.min(radius * 3 / 4, (radius * 3.0 / 4 * ((double) (dt - t3) / (double) (t4 - t3)))), delay, 0, 0, 0, SpiralType.HORIZONTAL1); new SuffocateSpiral(target, steps, radius
new SuffocateSpiral(target, steps, radius - Math.min(radius * 3 / 4, (radius * 3.0 / 4 * ((double) (dt - t3) / (double) (t4 - t3)))), delay, 0, 0, 0, SpiralType.VERTICAL1); - Math.min(radius * 3 / 4, (radius * 3.0 / 4 * ((double) (dt - t3) / (double) (t4 - t3)))), delay, 0, 0,
new SuffocateSpiral(target, steps, radius - Math.min(radius * 3 / 4, (radius * 3.0 / 4 * ((double) (dt - t3) / (double) (t4 - t3)))), delay, 0, 0, 0, SpiralType.VERTICAL2); 0, SpiralType.HORIZONTAL1);
new SuffocateSpiral(target, steps, radius
- Math.min(radius * 3 / 4, (radius * 3.0 / 4 * ((double) (dt - t3) / (double) (t4 - t3)))), delay, 0, 0,
0, SpiralType.VERTICAL1);
new SuffocateSpiral(target, steps, radius
- Math.min(radius * 3 / 4, (radius * 3.0 / 4 * ((double) (dt - t3) / (double) (t4 - t3)))), delay, 0, 0,
0, SpiralType.VERTICAL2);
} else { } else {
new SuffocateSpiral(target, steps, radius - (radius * 3.0 / 4.0), delay, 0, 0, 0, SpiralType.HORIZONTAL1); new SuffocateSpiral(target, steps, radius - (radius * 3.0 / 4.0), delay, 0, 0, 0, SpiralType.HORIZONTAL1);
new SuffocateSpiral(target, steps, radius - (radius * 3.0 / 4.0), delay, 0, 0, 0, SpiralType.VERTICAL1); new SuffocateSpiral(target, steps, radius - (radius * 3.0 / 4.0), delay, 0, 0, 0, SpiralType.VERTICAL1);
@ -364,7 +370,8 @@ public class Suffocate implements ConfigLoadable {
for (int i = 0; i < targets.size(); i++) { for (int i = 0; i < targets.size(); i++) {
LivingEntity target = targets.get(i); LivingEntity target = targets.get(i);
if (target.isDead() || !target.getWorld().equals(player.getWorld()) || target.getLocation().distance(player.getEyeLocation()) > range) { if (target.isDead() || !target.getWorld().equals(player.getWorld())
|| target.getLocation().distance(player.getEyeLocation()) > range) {
breakSuffocateLocal(target); breakSuffocateLocal(target);
i--; i--;
} else if (target instanceof Player) { } else if (target instanceof Player) {
@ -382,7 +389,8 @@ public class Suffocate implements ConfigLoadable {
if (reqConstantAim) { if (reqConstantAim) {
double dist = player.getEyeLocation().distance(targets.get(0).getEyeLocation()); double dist = player.getEyeLocation().distance(targets.get(0).getEyeLocation());
Location targetLoc = player.getEyeLocation().clone().add(player.getEyeLocation().getDirection().normalize().multiply(dist)); Location targetLoc = player.getEyeLocation().clone()
.add(player.getEyeLocation().getDirection().normalize().multiply(dist));
List<Entity> ents = GeneralMethods.getEntitiesAroundPoint(targetLoc, aimRadius); List<Entity> ents = GeneralMethods.getEntitiesAroundPoint(targetLoc, aimRadius);
for (int i = 0; i < targets.size(); i++) { for (int i = 0; i < targets.size(); i++) {
@ -573,9 +581,9 @@ public class Suffocate implements ConfigLoadable {
}; };
/** /**
* ** Animates a Spiral of air particles around a location or a targetted * ** Animates a Spiral of air particles around a location or a targetted entity. The direction
* entity. The direction of the spiral is determined by SpiralType, and each * of the spiral is determined by SpiralType, and each type is calculated independently from one
* type is calculated independently from one another. * another.
*/ */
public class SuffocateSpiral extends BukkitRunnable { public class SuffocateSpiral extends BukkitRunnable {
private Location startLoc; private Location startLoc;
@ -597,7 +605,8 @@ public class Suffocate implements ConfigLoadable {
* @param dz z offset * @param dz z offset
* @param type Spiral animation direction * @param type Spiral animation direction
*/ */
public SuffocateSpiral(LivingEntity lent, int totalSteps, double radius, long interval, double dx, double dy, double dz, SpiralType type) { public SuffocateSpiral(LivingEntity lent, int totalSteps, double radius, long interval, double dx, double dy, double dz,
SpiralType type) {
this.target = lent; this.target = lent;
this.totalSteps = totalSteps; this.totalSteps = totalSteps;
this.radius = radius; this.radius = radius;
@ -622,7 +631,8 @@ public class Suffocate implements ConfigLoadable {
* @param dz z offset * @param dz z offset
* @param type Spiral animation direction * @param type Spiral animation direction
*/ */
public SuffocateSpiral(Location startLoc, int totalSteps, double radius, long interval, double dx, double dy, double dz, SpiralType type) { public SuffocateSpiral(Location startLoc, int totalSteps, double radius, long interval, double dx, double dy, double dz,
SpiralType type) {
this.startLoc = startLoc; this.startLoc = startLoc;
this.totalSteps = totalSteps; this.totalSteps = totalSteps;
this.radius = radius; this.radius = radius;

View file

@ -17,7 +17,7 @@ import com.projectkorra.projectkorra.util.Flight;
public class Tornado implements ConfigLoadable { public class Tornado implements ConfigLoadable {
public static final ConcurrentHashMap<Player, Tornado> instances = new ConcurrentHashMap<>(); public static ConcurrentHashMap<Player, Tornado> instances = new ConcurrentHashMap<>();
private static double MAX_HEIGHT = config.get().getDouble("Abilities.Air.Tornado.Height"); private static double MAX_HEIGHT = config.get().getDouble("Abilities.Air.Tornado.Height");
private static double PLAYER_PUSH_FACTOR = config.get().getDouble("Abilities.Air.Tornado.PlayerPushFactor"); private static double PLAYER_PUSH_FACTOR = config.get().getDouble("Abilities.Air.Tornado.PlayerPushFactor");
@ -249,7 +249,8 @@ public class Tornado implements ConfigLoadable {
AirMethods.playAirbendingSound(effect); AirMethods.playAirbendingSound(effect);
} }
} }
// origin.getWorld().playEffect(effect, Effect.SMOKE, 4, (int) AirBlast.defaultrange); // origin.getWorld().playEffect(effect, Effect.SMOKE, 4, (int)
// AirBlast.defaultrange);
angles.put(i, angles.get(i) + 25 * (int) speedfactor); angles.put(i, angles.get(i) + 25 * (int) speedfactor);
} }

View file

@ -16,7 +16,7 @@ import com.projectkorra.projectkorra.configuration.ConfigLoadable;
public class Catapult implements ConfigLoadable { public class Catapult implements ConfigLoadable {
public static final ConcurrentHashMap<Player, Catapult> instances = new ConcurrentHashMap<>(); public static ConcurrentHashMap<Player, Catapult> instances = new ConcurrentHashMap<>();
private static int LENGTH = ProjectKorra.plugin.getConfig().getInt("Abilities.Earth.Catapult.Length"); private static int LENGTH = ProjectKorra.plugin.getConfig().getInt("Abilities.Earth.Catapult.Length");
private static double SPEED = ProjectKorra.plugin.getConfig().getDouble("Abilities.Earth.Catapult.Speed"); private static double SPEED = ProjectKorra.plugin.getConfig().getDouble("Abilities.Earth.Catapult.Speed");

View file

@ -55,7 +55,9 @@ public class ArcOfFire implements ConfigLoadable {
} }
public static String getDescription() { public static String getDescription() {
return "To use, simply left-click in any direction. " + "An arc of fire will flow from your location, " + "igniting anything in its path." + " Additionally, tap sneak to engulf the area around you " + "in roaring flames."; return "To use, simply left-click in any direction. " + "An arc of fire will flow from your location, "
+ "igniting anything in its path." + " Additionally, tap sneak to engulf the area around you "
+ "in roaring flames.";
} }
@Override @Override

View file

@ -85,7 +85,8 @@ public class Combustion implements ConfigLoadable {
if (instances.containsKey(player)) { if (instances.containsKey(player)) {
Combustion combustion = instances.get(player); Combustion combustion = instances.get(player);
combustion.createExplosion(combustion.location, combustion.power, breakblocks); combustion.createExplosion(combustion.location, combustion.power, breakblocks);
ParticleEffect.EXPLODE.display(combustion.location, (float) Math.random(), (float) Math.random(), (float) Math.random(), 0, 3); ParticleEffect.EXPLODE.display(combustion.location, (float) Math.random(), (float) Math.random(),
(float) Math.random(), 0, 3);
} }
} }
@ -103,8 +104,10 @@ public class Combustion implements ConfigLoadable {
} }
private void advanceLocation() { private void advanceLocation() {
ParticleEffect.FIREWORKS_SPARK.display(location, (float) Math.random()/2, (float) Math.random()/2, (float) Math.random()/2, 0, 5); ParticleEffect.FIREWORKS_SPARK.display(location, (float) Math.random() / 2, (float) Math.random() / 2,
ParticleEffect.FLAME.display(location, (float) Math.random()/2, (float) Math.random()/2, (float) Math.random()/2, 0, 2); (float) Math.random() / 2, 0, 5);
ParticleEffect.FLAME.display(location, (float) Math.random() / 2, (float) Math.random() / 2, (float) Math.random() / 2,
0, 2);
// if (Methods.rand.nextInt(4) == 0) { // if (Methods.rand.nextInt(4) == 0) {
FireMethods.playCombustionSound(location); FireMethods.playCombustionSound(location);
// } // }
@ -115,7 +118,8 @@ public class Combustion implements ConfigLoadable {
block.getWorld().createExplosion(block.getX(), block.getY(), block.getZ(), (float) defaultpower, true, breakblocks); block.getWorld().createExplosion(block.getX(), block.getY(), block.getZ(), (float) defaultpower, true, breakblocks);
for (Entity entity : block.getWorld().getEntities()) { for (Entity entity : block.getWorld().getEntities()) {
if (entity instanceof LivingEntity) { if (entity instanceof LivingEntity) {
if (entity.getLocation().distance(block) < radius) { // They are close enough to the explosion. if (entity.getLocation().distance(block) < radius) { // They are close enough to the
// explosion.
GeneralMethods.damageEntity(player, entity, damage, "Combustion"); GeneralMethods.damageEntity(player, entity, damage, "Combustion");
AirMethods.breakBreathbendingHold(entity); AirMethods.breakBreathbendingHold(entity);
} }
@ -140,7 +144,8 @@ public class Combustion implements ConfigLoadable {
return false; return false;
} }
if (GeneralMethods.getBoundAbility(player) == null || !GeneralMethods.getBoundAbility(player).equalsIgnoreCase("Combustion")) { if (GeneralMethods.getBoundAbility(player) == null
|| !GeneralMethods.getBoundAbility(player).equalsIgnoreCase("Combustion")) {
remove(); remove();
return false; return false;
} }
@ -164,7 +169,8 @@ public class Combustion implements ConfigLoadable {
Block block = location.getBlock(); Block block = location.getBlock();
if (block != null) { if (block != null) {
if (block.getType() != Material.AIR && block.getType() != Material.WATER && block.getType() != Material.STATIONARY_WATER) { if (block.getType() != Material.AIR && block.getType() != Material.WATER
&& block.getType() != Material.STATIONARY_WATER) {
createExplosion(block.getLocation(), power, breakblocks); createExplosion(block.getLocation(), power, breakblocks);
} }
} }

View file

@ -15,7 +15,9 @@ import com.projectkorra.projectkorra.util.ParticleEffect;
* Used in {@link HeatControl}. * Used in {@link HeatControl}.
*/ */
public class Cook { public class Cook {
public static final ConcurrentHashMap<Player, Cook> instances = new ConcurrentHashMap<>();
public static ConcurrentHashMap<Player, Cook> instances = new ConcurrentHashMap<>();
private static final long COOK_TIME = 2000; private static final long COOK_TIME = 2000;
private static final Material[] cookables = { Material.RAW_BEEF, Material.RAW_CHICKEN, Material.RAW_FISH, Material.PORK, private static final Material[] cookables = { Material.RAW_BEEF, Material.RAW_CHICKEN, Material.RAW_FISH, Material.PORK,
Material.POTATO_ITEM, Material.RABBIT, Material.MUTTON }; Material.POTATO_ITEM, Material.RABBIT, Material.MUTTON };

View file

@ -39,7 +39,8 @@ public class Extinguish implements ConfigLoadable {
return; return;
} }
double radius = FireMethods.getFirebendingDayAugment(defaultradius, player.getWorld()); double radius = FireMethods.getFirebendingDayAugment(defaultradius, player.getWorld());
for (Block block : GeneralMethods.getBlocksAroundPoint(player.getTargetBlock((HashSet<Material>) null, (int) range).getLocation(), radius)) { for (Block block : GeneralMethods.getBlocksAroundPoint(player.getTargetBlock((HashSet<Material>) null, (int) range)
.getLocation(), radius)) {
Material mat = block.getType(); Material mat = block.getType();
if (mat != Material.FIRE if (mat != Material.FIRE
@ -54,14 +55,11 @@ public class Extinguish implements ConfigLoadable {
block.getWorld().playEffect(block.getLocation(), Effect.EXTINGUISH, 0); block.getWorld().playEffect(block.getLocation(), Effect.EXTINGUISH, 0);
} /* } /*
* else if (block.getType() == Material.STATIONARY_LAVA) { * else if (block.getType() == Material.STATIONARY_LAVA) {
* block.setType(Material.OBSIDIAN); * block.setType(Material.OBSIDIAN); block.getWorld().playEffect(block.getLocation(),
* block.getWorld().playEffect(block.getLocation(), * Effect.EXTINGUISH, 0); } else if (block.getType() == Material.LAVA) { if
* Effect.EXTINGUISH, 0); } else if (block.getType() == * (block.getData() == full) { block.setType(Material.OBSIDIAN); } else {
* Material.LAVA) { if (block.getData() == full) {
* block.setType(Material.OBSIDIAN); } else {
* block.setType(Material.COBBLESTONE); } * block.setType(Material.COBBLESTONE); }
* block.getWorld().playEffect(block.getLocation(), * block.getWorld().playEffect(block.getLocation(), Effect.EXTINGUISH, 0); }
* Effect.EXTINGUISH, 0); }
*/ */
} }
@ -86,7 +84,11 @@ public class Extinguish implements ConfigLoadable {
} }
public static String getDescription() { public static String getDescription() {
return "While this ability is selected, the firebender becomes impervious " + "to fire damage and cannot be ignited. " + "If the user left-clicks with this ability, the targeted area will be " + "extinguished, although it will leave any creature burning engulfed in flames. " + "This ability can also cool lava. If this ability is used while targetting ice or snow, it" + " will instead melt blocks in that area. Finally, sneaking with this ability will cook any food in your hand."; return "While this ability is selected, the firebender becomes impervious " + "to fire damage and cannot be ignited. "
+ "If the user left-clicks with this ability, the targeted area will be "
+ "extinguished, although it will leave any creature burning engulfed in flames. "
+ "This ability can also cool lava. If this ability is used while targetting ice or snow, it"
+ " will instead melt blocks in that area. Finally, sneaking with this ability will cook any food in your hand.";
} }
@Override @Override

View file

@ -28,6 +28,7 @@ import com.projectkorra.projectkorra.waterbending.WaterManipulation;
import com.projectkorra.projectkorra.waterbending.WaterMethods; import com.projectkorra.projectkorra.waterbending.WaterMethods;
public class FireBlast implements ConfigLoadable { public class FireBlast implements ConfigLoadable {
public static ConcurrentHashMap<Integer, FireBlast> instances = new ConcurrentHashMap<>(); public static ConcurrentHashMap<Integer, FireBlast> instances = new ConcurrentHashMap<>();
private static double SPEED = config.get().getDouble("Abilities.Fire.FireBlast.Speed"); private static double SPEED = config.get().getDouble("Abilities.Fire.FireBlast.Speed");

View file

@ -21,6 +21,7 @@ import com.projectkorra.projectkorra.configuration.ConfigLoadable;
public class FireBurst implements ConfigLoadable { public class FireBurst implements ConfigLoadable {
public static final ConcurrentHashMap<Player, FireBurst> instances = new ConcurrentHashMap<>(); public static final ConcurrentHashMap<Player, FireBurst> instances = new ConcurrentHashMap<>();
private static double PARTICLES_PERCENTAGE = 5; private static double PARTICLES_PERCENTAGE = 5;
private Player player; private Player player;
@ -64,7 +65,9 @@ public class FireBurst implements ConfigLoadable {
} }
public static String getDescription() { public static String getDescription() {
return "FireBurst is a very powerful firebending ability. " + "To use, press and hold sneak to charge your burst. " + "Once charged, you can either release sneak to launch a cone-shaped burst " + "of flames in front of you, or click to release the burst in a sphere around you. "; return "FireBurst is a very powerful firebending ability. " + "To use, press and hold sneak to charge your burst. "
+ "Once charged, you can either release sneak to launch a cone-shaped burst "
+ "of flames in front of you, or click to release the burst in a sphere around you. ";
} }
private void coneBurst() { private void coneBurst() {
@ -124,9 +127,9 @@ public class FireBurst implements ConfigLoadable {
} }
/** /**
* To combat the sphere FireBurst lag we are only going to show a certain * To combat the sphere FireBurst lag we are only going to show a certain percentage of
* percentage of FireBurst particles at a time per tick. As the bursts * FireBurst particles at a time per tick. As the bursts spread out then we can show more at a
* spread out then we can show more at a time. * time.
*/ */
public void handleSmoothParticles() { public void handleSmoothParticles() {
for (int i = 0; i < blasts.size(); i++) { for (int i = 0; i < blasts.size(); i++) {

View file

@ -151,8 +151,8 @@ public class FireCombo implements ConfigLoadable {
} }
/** /**
* Returns all of the FireCombos created by a specific player but filters * Returns all of the FireCombos created by a specific player but filters the abilities based on
* the abilities based on shift or click. * shift or click.
*/ */
public static ArrayList<FireCombo> getFireCombo(Player player, ClickType type) { public static ArrayList<FireCombo> getFireCombo(Player player, ClickType type) {
ArrayList<FireCombo> list = new ArrayList<FireCombo>(); ArrayList<FireCombo> list = new ArrayList<FireCombo>();
@ -182,7 +182,8 @@ public class FireCombo implements ConfigLoadable {
if (ability.equalsIgnoreCase("FireKick") && combo.ability.equalsIgnoreCase("FireKick")) { if (ability.equalsIgnoreCase("FireKick") && combo.ability.equalsIgnoreCase("FireKick")) {
for (FireComboStream fs : combo.tasks) { for (FireComboStream fs : combo.tasks) {
if (fs.getLocation() != null && fs.getLocation().getWorld() == loc.getWorld() && Math.abs(fs.getLocation().distance(loc)) <= radius) { if (fs.getLocation() != null && fs.getLocation().getWorld() == loc.getWorld()
&& Math.abs(fs.getLocation().distance(loc)) <= radius) {
fs.remove(); fs.remove();
removed = true; removed = true;
} }
@ -316,7 +317,8 @@ public class FireCombo implements ConfigLoadable {
vec = GeneralMethods.rotateXZ(vec, i - 180); vec = GeneralMethods.rotateXZ(vec, i - 180);
vec.setY(0); vec.setY(0);
FireComboStream fs = new FireComboStream(this, vec, player.getLocation().clone().add(0, 1, 0), range, speed, "FireSpin"); FireComboStream fs = new FireComboStream(this, vec, player.getLocation().clone().add(0, 1, 0), range, speed,
"FireSpin");
fs.setSpread(0.0F); fs.setSpread(0.0F);
fs.setDensity(1); fs.setDensity(1);
fs.setUseNewParticles(true); fs.setUseNewParticles(true);
@ -354,7 +356,8 @@ public class FireCombo implements ConfigLoadable {
} }
player.setVelocity(player.getVelocity().normalize().multiply(speed)); player.setVelocity(player.getVelocity().normalize().multiply(speed));
FireComboStream fs = new FireComboStream(this, player.getVelocity().clone().multiply(-1), player.getLocation(), 3, 0.5, "JetBlast"); FireComboStream fs = new FireComboStream(this, player.getVelocity().clone().multiply(-1), player.getLocation(),
3, 0.5, "JetBlast");
fs.setDensity(1); fs.setDensity(1);
fs.setSpread(0.9F); fs.setSpread(0.9F);
fs.setUseNewParticles(true); fs.setUseNewParticles(true);
@ -477,8 +480,8 @@ public class FireCombo implements ConfigLoadable {
} }
/** /**
* Removes this instance of FireCombo, cleans up any blocks that are * Removes this instance of FireCombo, cleans up any blocks that are remaining in totalBlocks,
* remaining in totalBlocks, and cancels any remaining tasks. * and cancels any remaining tasks.
*/ */
public void remove() { public void remove() {
instances.remove(this); instances.remove(this);

View file

@ -11,14 +11,15 @@ import org.bukkit.util.Vector;
import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.BendingPlayer;
import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.AvatarState; import com.projectkorra.projectkorra.ability.AvatarState;
import com.projectkorra.projectkorra.airbending.AirBurst;
import com.projectkorra.projectkorra.configuration.ConfigLoadable; import com.projectkorra.projectkorra.configuration.ConfigLoadable;
import com.projectkorra.projectkorra.util.Flight; import com.projectkorra.projectkorra.util.Flight;
import com.projectkorra.projectkorra.util.ParticleEffect; import com.projectkorra.projectkorra.util.ParticleEffect;
import com.projectkorra.projectkorra.waterbending.WaterMethods; import com.projectkorra.projectkorra.waterbending.WaterMethods;
public class FireJet implements ConfigLoadable { public class FireJet implements ConfigLoadable {
public static final ConcurrentHashMap<Player, FireJet> instances = new ConcurrentHashMap<>();
public static ConcurrentHashMap<Player, FireJet> instances = new ConcurrentHashMap<>();
private static double defaultfactor = config.get().getDouble("Abilities.Fire.FireJet.Speed"); private static double defaultfactor = config.get().getDouble("Abilities.Fire.FireJet.Speed");
private static long defaultduration = config.get().getLong("Abilities.Fire.FireJet.Duration"); private static long defaultduration = config.get().getLong("Abilities.Fire.FireJet.Duration");
private static boolean isToggle = config.get().getBoolean("Abilities.Fire.FireJet.IsAvatarStateToggle"); private static boolean isToggle = config.get().getBoolean("Abilities.Fire.FireJet.IsAvatarStateToggle");
@ -46,8 +47,8 @@ public class FireJet implements ConfigLoadable {
player.setVelocity(player.getEyeLocation().getDirection().clone().normalize().multiply(factor)); player.setVelocity(player.getEyeLocation().getDirection().clone().normalize().multiply(factor));
if (FireMethods.canFireGrief()) { if (FireMethods.canFireGrief()) {
FireMethods.createTempFire(block.getLocation()); FireMethods.createTempFire(block.getLocation());
} } else
else block.setType(Material.FIRE); block.setType(Material.FIRE);
this.player = player; this.player = player;
// canfly = player.getAllowFlight(); // canfly = player.getAllowFlight();
new Flight(player); new Flight(player);
@ -93,7 +94,8 @@ public class FireJet implements ConfigLoadable {
remove(); remove();
return false; return false;
} }
if ((WaterMethods.isWater(player.getLocation().getBlock()) || System.currentTimeMillis() > time + duration) && (!AvatarState.isAvatarState(player) || !isToggle)) { if ((WaterMethods.isWater(player.getLocation().getBlock()) || System.currentTimeMillis() > time + duration)
&& (!AvatarState.isAvatarState(player) || !isToggle)) {
// player.setAllowFlight(canfly); // player.setAllowFlight(canfly);
remove(); remove();
} else { } else {

View file

@ -47,23 +47,45 @@ public class FireMethods {
return false; return false;
} }
/**Returns if fire is allowed to completely replace blocks or if it should place a temp fire block.*/ /**
* Returns if fire is allowed to completely replace blocks or if it should place a temp fire
* block.
*/
public static boolean canFireGrief() { public static boolean canFireGrief() {
return config.getBoolean("Properties.Fire.FireGriefing"); return config.getBoolean("Properties.Fire.FireGriefing");
} }
/**Creates a fire block meant to replace other blocks but reverts when the fire dissipates or is destroyed.*/ /**
* Creates a fire block meant to replace other blocks but reverts when the fire dissipates or is
* destroyed.
*/
public static void createTempFire(Location loc) { public static void createTempFire(Location loc) {
if (loc.getBlock().getType() == Material.AIR) { if (loc.getBlock().getType() == Material.AIR) {
loc.getBlock().setType(Material.FIRE); loc.getBlock().setType(Material.FIRE);
return; return;
} }
Information info = new Information(); Information info = new Information();
long time = config.getLong("Properties.Fire.RevertTicks") + (long)(GeneralMethods.rand.nextDouble() * config.getLong("Properties.Fire.RevertTicks")); //Generate a long between the config time and config time x 2. Just so it appears random long time = config.getLong("Properties.Fire.RevertTicks")
+ (long) (GeneralMethods.rand.nextDouble() * config.getLong("Properties.Fire.RevertTicks")); // Generate
// a
// long
// between
// the
// config
// time
// and
// config
// time
// x
// 2.
// Just
// so
// it
// appears
// random
if (tempFire.containsKey(loc)) { if (tempFire.containsKey(loc)) {
info = tempFire.get(loc); info = tempFire.get(loc);
} } else {
else {
info.setBlock(loc.getBlock()); info.setBlock(loc.getBlock());
info.setLocation(loc); info.setLocation(loc);
info.setState(loc.getBlock().getState()); info.setState(loc.getBlock().getState());
@ -74,13 +96,11 @@ public class FireMethods {
} }
/** /**
* Gets the firebending dayfactor from the config multiplied by a specific * Gets the firebending dayfactor from the config multiplied by a specific value if it is day.
* value if it is day.
* *
* @param value The value * @param value The value
* @param world The world to pass into {@link #isDay(World)} * @param world The world to pass into {@link #isDay(World)}
* @return value DayFactor multiplied by specified value when * @return value DayFactor multiplied by specified value when {@link #isDay(World)} is true <br />
* {@link #isDay(World)} is true <br />
* else <br /> * else <br />
* value The specified value in the parameters * value The specified value in the parameters
*/ */
@ -186,10 +206,10 @@ public class FireMethods {
while (it.hasNext()) { while (it.hasNext()) {
Location loc = it.next(); Location loc = it.next();
Information info = tempFire.get(loc); Information info = tempFire.get(loc);
if (info.getLocation().getBlock().getType() != Material.FIRE && info.getLocation().getBlock().getType() != Material.AIR) { if (info.getLocation().getBlock().getType() != Material.FIRE
&& info.getLocation().getBlock().getType() != Material.AIR) {
revertTempFire(loc); revertTempFire(loc);
} } else if (info.getBlock().getType() == Material.AIR || System.currentTimeMillis() > info.getTime()) {
else if (info.getBlock().getType() == Material.AIR || System.currentTimeMillis() > info.getTime()) {
revertTempFire(loc); revertTempFire(loc);
} }
} }
@ -202,14 +222,18 @@ public class FireMethods {
* */ * */
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public static void revertTempFire(Location location) { public static void revertTempFire(Location location) {
if (!tempFire.containsKey(location)) return; if (!tempFire.containsKey(location))
return;
Information info = tempFire.get(location); Information info = tempFire.get(location);
if (info.getLocation().getBlock().getType() != Material.FIRE && info.getLocation().getBlock().getType() != Material.AIR) { if (info.getLocation().getBlock().getType() != Material.FIRE && info.getLocation().getBlock().getType() != Material.AIR) {
if (info.getState().getType() == Material.RED_ROSE || info.getState().getType() == Material.YELLOW_FLOWER) { if (info.getState().getType() == Material.RED_ROSE || info.getState().getType() == Material.YELLOW_FLOWER) {
info.getState().getBlock().getWorld().dropItemNaturally(info.getLocation(), new ItemStack(info.getState().getData().getItemType(), 1, info.getState().getRawData())); info.getState()
.getBlock()
.getWorld()
.dropItemNaturally(info.getLocation(),
new ItemStack(info.getState().getData().getItemType(), 1, info.getState().getRawData()));
} }
} } else {
else {
info.getBlock().setType(info.getState().getType()); info.getBlock().setType(info.getState().getType());
info.getBlock().setData(info.getState().getRawData()); info.getBlock().setData(info.getState().getRawData());
} }

View file

@ -22,7 +22,9 @@ import com.projectkorra.projectkorra.util.ParticleEffect;
import com.projectkorra.projectkorra.waterbending.WaterManipulation; import com.projectkorra.projectkorra.waterbending.WaterManipulation;
public class FireShield implements ConfigLoadable { public class FireShield implements ConfigLoadable {
public static final ConcurrentHashMap<Player, FireShield> instances = new ConcurrentHashMap<>();
public static ConcurrentHashMap<Player, FireShield> instances = new ConcurrentHashMap<>();
private static long interval = 100; private static long interval = 100;
private static long DURATION = config.get().getLong("Abilities.Fire.FireShield.Duration"); private static long DURATION = config.get().getLong("Abilities.Fire.FireShield.Duration");
private static double RADIUS = config.get().getDouble("Abilities.Fire.FireShield.Radius"); private static double RADIUS = config.get().getDouble("Abilities.Fire.FireShield.Radius");
@ -64,7 +66,11 @@ public class FireShield implements ConfigLoadable {
} }
public static String getDescription() { public static String getDescription() {
return "FireShield is a basic defensive ability. " + "Clicking with this ability selected will create a " + "small disc of fire in front of you, which will block most " + "attacks and bending. Alternatively, pressing and holding " + "sneak creates a very small shield of fire, blocking most attacks. " + "Creatures that contact this fire are ignited."; return "FireShield is a basic defensive ability. " + "Clicking with this ability selected will create a "
+ "small disc of fire in front of you, which will block most "
+ "attacks and bending. Alternatively, pressing and holding "
+ "sneak creates a very small shield of fire, blocking most attacks. "
+ "Creatures that contact this fire are ignited.";
} }
public static boolean isWithinShield(Location loc) { public static boolean isWithinShield(Location loc) {
@ -143,7 +149,10 @@ public class FireShield implements ConfigLoadable {
for (double phi = 0; phi < 360; phi += 20) { for (double phi = 0; phi < 360; phi += 20) {
double rphi = Math.toRadians(phi); double rphi = Math.toRadians(phi);
double rtheta = Math.toRadians(theta); double rtheta = Math.toRadians(theta);
Block block = location.clone().add(radius * Math.cos(rphi) * Math.sin(rtheta), radius * Math.cos(rtheta), radius * Math.sin(rphi) * Math.sin(rtheta)).getBlock(); Block block = location
.clone()
.add(radius * Math.cos(rphi) * Math.sin(rtheta), radius * Math.cos(rtheta),
radius * Math.sin(rphi) * Math.sin(rtheta)).getBlock();
if (!blocks.contains(block) && !GeneralMethods.isSolid(block) && !block.isLiquid()) if (!blocks.contains(block) && !GeneralMethods.isSolid(block) && !block.isLiquid())
blocks.add(block); blocks.add(block);
} }

View file

@ -18,7 +18,8 @@ import com.projectkorra.projectkorra.waterbending.Plantbending;
import com.projectkorra.projectkorra.waterbending.WaterMethods; import com.projectkorra.projectkorra.waterbending.WaterMethods;
public class FireStream implements ConfigLoadable { public class FireStream implements ConfigLoadable {
public static final ConcurrentHashMap<Integer, FireStream> instances = new ConcurrentHashMap<>();
public static ConcurrentHashMap<Integer, FireStream> instances = new ConcurrentHashMap<>();
public static ConcurrentHashMap<Block, Player> ignitedblocks = new ConcurrentHashMap<Block, Player>(); public static ConcurrentHashMap<Block, Player> ignitedblocks = new ConcurrentHashMap<Block, Player>();
public static ConcurrentHashMap<Block, Long> ignitedtimes = new ConcurrentHashMap<Block, Long>(); public static ConcurrentHashMap<Block, Long> ignitedtimes = new ConcurrentHashMap<Block, Long>();
public static ConcurrentHashMap<Location, MaterialData> replacedBlocks = new ConcurrentHashMap<Location, MaterialData>(); public static ConcurrentHashMap<Location, MaterialData> replacedBlocks = new ConcurrentHashMap<Location, MaterialData>();
@ -80,7 +81,8 @@ public class FireStream implements ConfigLoadable {
public static boolean isIgnitable(Player player, Block block) { public static boolean isIgnitable(Player player, Block block) {
Material[] overwriteable = { Material.SAPLING, Material.LONG_GRASS, Material.DEAD_BUSH, Material.YELLOW_FLOWER, Material.RED_ROSE, Material.BROWN_MUSHROOM, Material.RED_MUSHROOM, Material.FIRE, Material.SNOW, Material.TORCH }; Material[] overwriteable = { Material.SAPLING, Material.LONG_GRASS, Material.DEAD_BUSH, Material.YELLOW_FLOWER,
Material.RED_ROSE, Material.BROWN_MUSHROOM, Material.RED_MUSHROOM, Material.FIRE, Material.SNOW, Material.TORCH };
if (Arrays.asList(overwriteable).contains(block.getType())) { if (Arrays.asList(overwriteable).contains(block.getType())) {
return true; return true;
@ -88,8 +90,24 @@ public class FireStream implements ConfigLoadable {
return false; return false;
} }
Material[] ignitable = { Material.BEDROCK, Material.BOOKSHELF, Material.BRICK, Material.CLAY, Material.CLAY_BRICK, Material.COAL_ORE, Material.COBBLESTONE, Material.DIAMOND_ORE, Material.DIAMOND_BLOCK, Material.DIRT, Material.ENDER_STONE, Material.GLOWING_REDSTONE_ORE, Material.GOLD_BLOCK, Material.GRAVEL, Material.GRASS, Material.HUGE_MUSHROOM_1, Material.HUGE_MUSHROOM_2, Material.LAPIS_BLOCK, Material.LAPIS_ORE, Material.LOG, Material.MOSSY_COBBLESTONE, Material.MYCEL, Material.NETHER_BRICK, Material.NETHERRACK, Material.OBSIDIAN, Material.REDSTONE_ORE, Material.SAND, Material.SANDSTONE, Material.SMOOTH_BRICK, Material.STONE, Material.SOUL_SAND, Material.WOOD, // Material.SNOW_BLOCK, Material[] ignitable = { Material.BEDROCK, Material.BOOKSHELF, Material.BRICK, Material.CLAY, Material.CLAY_BRICK,
Material.WOOL, Material.LEAVES, Material.LEAVES_2, Material.MELON_BLOCK, Material.PUMPKIN, Material.JACK_O_LANTERN, Material.NOTE_BLOCK, Material.GLOWSTONE, Material.IRON_BLOCK, Material.DISPENSER, Material.SPONGE, Material.IRON_ORE, Material.GOLD_ORE, Material.COAL_BLOCK, Material.WORKBENCH, Material.HAY_BLOCK, Material.REDSTONE_LAMP_OFF, Material.REDSTONE_LAMP_ON, Material.EMERALD_ORE, Material.EMERALD_BLOCK, Material.REDSTONE_BLOCK, Material.QUARTZ_BLOCK, Material.QUARTZ_ORE, Material.STAINED_CLAY, Material.HARD_CLAY }; Material.COAL_ORE, Material.COBBLESTONE, Material.DIAMOND_ORE, Material.DIAMOND_BLOCK, Material.DIRT,
Material.ENDER_STONE, Material.GLOWING_REDSTONE_ORE, Material.GOLD_BLOCK, Material.GRAVEL, Material.GRASS,
Material.HUGE_MUSHROOM_1, Material.HUGE_MUSHROOM_2, Material.LAPIS_BLOCK, Material.LAPIS_ORE, Material.LOG,
Material.MOSSY_COBBLESTONE, Material.MYCEL, Material.NETHER_BRICK, Material.NETHERRACK, Material.OBSIDIAN,
Material.REDSTONE_ORE,
Material.SAND,
Material.SANDSTONE,
Material.SMOOTH_BRICK,
Material.STONE,
Material.SOUL_SAND,
Material.WOOD, // Material.SNOW_BLOCK,
Material.WOOL, Material.LEAVES, Material.LEAVES_2, Material.MELON_BLOCK, Material.PUMPKIN,
Material.JACK_O_LANTERN, Material.NOTE_BLOCK, Material.GLOWSTONE, Material.IRON_BLOCK, Material.DISPENSER,
Material.SPONGE, Material.IRON_ORE, Material.GOLD_ORE, Material.COAL_BLOCK, Material.WORKBENCH,
Material.HAY_BLOCK, Material.REDSTONE_LAMP_OFF, Material.REDSTONE_LAMP_ON, Material.EMERALD_ORE,
Material.EMERALD_BLOCK, Material.REDSTONE_BLOCK, Material.QUARTZ_BLOCK, Material.QUARTZ_ORE,
Material.STAINED_CLAY, Material.HARD_CLAY };
Block belowblock = block.getRelative(BlockFace.DOWN); Block belowblock = block.getRelative(BlockFace.DOWN);
if (Arrays.asList(ignitable).contains(belowblock.getType())) { if (Arrays.asList(ignitable).contains(belowblock.getType())) {
@ -145,7 +163,8 @@ public class FireStream implements ConfigLoadable {
private void ignite(Block block) { private void ignite(Block block) {
if (block.getType() != Material.AIR) { if (block.getType() != Material.AIR) {
if (FireMethods.canFireGrief()) { if (FireMethods.canFireGrief()) {
if (WaterMethods.isPlant(block)) new Plantbending(block); if (WaterMethods.isPlant(block))
new Plantbending(block);
} else if (block.getType() != Material.FIRE) { } else if (block.getType() != Material.FIRE) {
replacedBlocks.put(block.getLocation(), block.getState().getData()); replacedBlocks.put(block.getLocation(), block.getState().getData());
} }

View file

@ -25,7 +25,8 @@ import com.projectkorra.projectkorra.util.ParticleEffect;
*/ */
public class Fireball implements ConfigLoadable { public class Fireball implements ConfigLoadable {
public static final ConcurrentHashMap<Integer, Fireball> instances = new ConcurrentHashMap<>(); public static ConcurrentHashMap<Integer, Fireball> instances = new ConcurrentHashMap<>();
private static ConcurrentHashMap<Entity, Fireball> explosions = new ConcurrentHashMap<Entity, Fireball>(); private static ConcurrentHashMap<Entity, Fireball> explosions = new ConcurrentHashMap<Entity, Fireball>();
private static long defaultchargetime = config.get().getLong("Abilities.Fire.FireBlast.Charged.ChargeTime"); private static long defaultchargetime = config.get().getLong("Abilities.Fire.FireBlast.Charged.ChargeTime");
@ -156,8 +157,7 @@ public class Fireball implements ConfigLoadable {
} }
} }
if (explode) { if (explode) {
if (damage_blocks && explosionradius > 0) if (damage_blocks && explosionradius > 0) {
{
explosion = player.getWorld().spawn(location, TNTPrimed.class); explosion = player.getWorld().spawn(location, TNTPrimed.class);
explosion.setFuseTicks(0); explosion.setFuseTicks(0);
float yield = (float) explosionradius; float yield = (float) explosionradius;
@ -170,14 +170,10 @@ public class Fireball implements ConfigLoadable {
} }
explosion.setYield(yield); explosion.setYield(yield);
explosions.put(explosion, this); explosions.put(explosion, this);
} } else {
else
{
List<Entity> l = GeneralMethods.getEntitiesAroundPoint(location, damageradius); List<Entity> l = GeneralMethods.getEntitiesAroundPoint(location, damageradius);
for (Entity e : l) for (Entity e : l) {
{ if (e instanceof LivingEntity) {
if (e instanceof LivingEntity)
{
double slope = -(maxdamage * .5) / (damageradius - innerradius); double slope = -(maxdamage * .5) / (damageradius - innerradius);
double damage = slope * (e.getLocation().distance(location) - innerradius) + maxdamage; double damage = slope * (e.getLocation().distance(location) - innerradius) + maxdamage;
GeneralMethods.damageEntity(getPlayer(), e, damage, "FireBlast"); GeneralMethods.damageEntity(getPlayer(), e, damage, "FireBlast");

View file

@ -20,7 +20,9 @@ import com.projectkorra.projectkorra.util.TempBlock;
* Created by Carbogen on 11/02/15. Ability HeatControl * Created by Carbogen on 11/02/15. Ability HeatControl
*/ */
public class HeatControl implements ConfigLoadable { public class HeatControl implements ConfigLoadable {
public static final ConcurrentHashMap<Player, HeatControl> instances = new ConcurrentHashMap<>();
public static ConcurrentHashMap<Player, HeatControl> instances = new ConcurrentHashMap<>();
public static double RANGE = config.get().getDouble("Abilities.Fire.HeatControl.Solidify.Range"); public static double RANGE = config.get().getDouble("Abilities.Fire.HeatControl.Solidify.Range");
public static int RADIUS = config.get().getInt("Abilities.Fire.HeatControl.Solidify.Radius"); public static int RADIUS = config.get().getInt("Abilities.Fire.HeatControl.Solidify.Radius");
public static int REVERT_TIME = config.get().getInt("Abilities.Fire.HeatControl.Solidify.RevertTime"); public static int REVERT_TIME = config.get().getInt("Abilities.Fire.HeatControl.Solidify.RevertTime");

View file

@ -17,8 +17,10 @@ public class HeatMelt implements ConfigLoadable {
public HeatMelt(Player player) { public HeatMelt(Player player) {
// reloadVariables(); // reloadVariables();
Location location = GeneralMethods.getTargetedLocation(player, (int) FireMethods.getFirebendingDayAugment(range, player.getWorld())); Location location = GeneralMethods.getTargetedLocation(player,
for (Block block : GeneralMethods.getBlocksAroundPoint(location, (int) FireMethods.getFirebendingDayAugment(radius, player.getWorld()))) { (int) FireMethods.getFirebendingDayAugment(range, player.getWorld()));
for (Block block : GeneralMethods.getBlocksAroundPoint(location,
(int) FireMethods.getFirebendingDayAugment(radius, player.getWorld()))) {
if (WaterMethods.isMeltable(block)) { if (WaterMethods.isMeltable(block)) {
Melt.melt(player, block); Melt.melt(player, block);
} else if (isHeatable(block)) { } else if (isHeatable(block)) {

View file

@ -12,7 +12,8 @@ import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.configuration.ConfigLoadable; import com.projectkorra.projectkorra.configuration.ConfigLoadable;
public class Illumination implements ConfigLoadable { public class Illumination implements ConfigLoadable {
public static final ConcurrentHashMap<Player, Illumination> instances = new ConcurrentHashMap<>();
public static ConcurrentHashMap<Player, Illumination> instances = new ConcurrentHashMap<>();
public static ConcurrentHashMap<Block, Player> blocks = new ConcurrentHashMap<Block, Player>(); public static ConcurrentHashMap<Block, Player> blocks = new ConcurrentHashMap<Block, Player>();
private static int range = config.get().getInt("Abilities.Fire.Illumination.Range"); private static int range = config.get().getInt("Abilities.Fire.Illumination.Range");
@ -41,7 +42,11 @@ public class Illumination implements ConfigLoadable {
} }
public static String getDescription() { public static String getDescription() {
return "This ability gives firebenders a means of illuminating the area. It is a toggle - clicking " + "will create a torch that follows you around. The torch will only appear on objects that are " + "ignitable and can hold a torch (e.g. not leaves or ice). If you get too far away from the torch, " + "it will disappear, but will reappear when you get on another ignitable block. Clicking again " + "dismisses this torch."; return "This ability gives firebenders a means of illuminating the area. It is a toggle - clicking "
+ "will create a torch that follows you around. The torch will only appear on objects that are "
+ "ignitable and can hold a torch (e.g. not leaves or ice). If you get too far away from the torch, "
+ "it will disappear, but will reappear when you get on another ignitable block. Clicking again "
+ "dismisses this torch.";
} }
public static void revert(Block block) { public static void revert(Block block) {
@ -120,13 +125,18 @@ public class Illumination implements ConfigLoadable {
Block standblock = standingblock.getRelative(BlockFace.DOWN); Block standblock = standingblock.getRelative(BlockFace.DOWN);
if (standblock.getType() == Material.GLOWSTONE) { if (standblock.getType() == Material.GLOWSTONE) {
revert(); revert();
} else if ((FireStream.isIgnitable(player, standingblock) && standblock.getType() != Material.LEAVES && standblock.getType() != Material.LEAVES_2) && block == null && !blocks.containsKey(standblock)) { } else if ((FireStream.isIgnitable(player, standingblock) && standblock.getType() != Material.LEAVES && standblock
.getType() != Material.LEAVES_2) && block == null && !blocks.containsKey(standblock)) {
block = standingblock; block = standingblock;
normaltype = block.getType(); normaltype = block.getType();
normaldata = block.getData(); normaldata = block.getData();
block.setType(Material.TORCH); block.setType(Material.TORCH);
blocks.put(block, player); blocks.put(block, player);
} else if ((FireStream.isIgnitable(player, standingblock) && standblock.getType() != Material.LEAVES && standblock.getType() != Material.LEAVES_2) && !block.equals(standblock) && !blocks.containsKey(standblock) && GeneralMethods.isSolid(standblock)) { } else if ((FireStream.isIgnitable(player, standingblock) && standblock.getType() != Material.LEAVES && standblock
.getType() != Material.LEAVES_2)
&& !block.equals(standblock)
&& !blocks.containsKey(standblock)
&& GeneralMethods.isSolid(standblock)) {
revert(); revert();
block = standingblock; block = standingblock;
normaltype = block.getType(); normaltype = block.getType();
@ -137,7 +147,8 @@ public class Illumination implements ConfigLoadable {
return; return;
} else if (!player.getWorld().equals(block.getWorld())) { } else if (!player.getWorld().equals(block.getWorld())) {
revert(); revert();
} else if (player.getLocation().distance(block.getLocation()) > FireMethods.getFirebendingDayAugment(range, player.getWorld())) { } else if (player.getLocation().distance(block.getLocation()) > FireMethods.getFirebendingDayAugment(range,
player.getWorld())) {
revert(); revert();
} }
} }

View file

@ -23,6 +23,7 @@ import com.projectkorra.projectkorra.configuration.ConfigLoadable;
import com.projectkorra.projectkorra.earthbending.EarthMethods; import com.projectkorra.projectkorra.earthbending.EarthMethods;
public class Lightning implements ConfigLoadable { public class Lightning implements ConfigLoadable {
public static ConcurrentHashMap<Integer, Lightning> instances = new ConcurrentHashMap<>(); public static ConcurrentHashMap<Integer, Lightning> instances = new ConcurrentHashMap<>();
public static boolean SELF_HIT_WATER = config.get().getBoolean("Abilities.Fire.Lightning.SelfHitWater"); public static boolean SELF_HIT_WATER = config.get().getBoolean("Abilities.Fire.Lightning.SelfHitWater");

View file

@ -47,8 +47,7 @@ public class RingOfFire implements ConfigLoadable {
} }
public static String getDescription() { public static String getDescription() {
return "To use, simply left-click. " return "To use, simply left-click. " + "A circle of fire will emanate from you, "
+ "A circle of fire will emanate from you, "
+ "engulfing everything around you. Use with extreme caution."; + "engulfing everything around you. Use with extreme caution.";
} }

View file

@ -20,7 +20,8 @@ import com.projectkorra.projectkorra.configuration.ConfigLoadable;
import com.projectkorra.projectkorra.util.ParticleEffect; import com.projectkorra.projectkorra.util.ParticleEffect;
public class WallOfFire implements ConfigLoadable { public class WallOfFire implements ConfigLoadable {
public static final ConcurrentHashMap<Player, WallOfFire> instances = new ConcurrentHashMap<>();
public static ConcurrentHashMap<Player, WallOfFire> instances = new ConcurrentHashMap<>();
private static double maxangle = 50; private static double maxangle = 50;