mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-12-22 16:05:01 +00:00
Blue Fire Update & Firebending Refactor (#1062)
## Additions * Adds Blue Fire SubElement. > *Adds related damage, cooldown, and range modifiers for configuration * Adds Sticks, Sponges, and Chorus Fruit to cookable HeatControl items. * Adds Smoker, BlastFurnace, and extinguished Campfires to blocks which FireBlast can light. * Adds new TempBlock constructor which takes in a `long revertTime` parameter * Adds new blocks to block lists in configuration >* Adds new nether plants to plantBlocks list >* Adds new earth blocks to earthBlocks list ## Fixes * Fixes AvatarState buffs overriding day related buffs for firebending. * Fixes Blaze not going up hills, going through walls (mostly), jumping gaps. * Fixes Furnaces and related blocks not smelting after being activated by FireBlast ## Removals * Removes BlazeArc dependencies for Fire Abilities which ignite the ground. * Removes smoke particles from Fire bending to increase visibility and better emulate the show. ## Misc. Changes * Changes API versioning to 1.16.1 * Fire from Firebending no longer reverts all at once. * Changes Combustion animation to be more beam-like rather than a rehash of FireBlast. * Changes Add, Remove, Display command to properly display space for Blue Fire. * Changes `ElementalAbility#isFire()` to check for SOUL_FIRE_FLAME. * Changes isIgnitable to check whether fire can be placed at that location rather than solely based on flammability. * Changes firebending abilities to use `FireAbility#playFirebendingParticles()` & `FireAbility#createTempFire()` where applicable. * Changes `FireAbility#playFirebendingParticles()` to play blue fire particles when player has the BlueFire subelement.
This commit is contained in:
parent
c12e0daebb
commit
3c1d6b7b85
36 changed files with 419 additions and 426 deletions
2
pom.xml
2
pom.xml
|
@ -65,7 +65,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>1.13.2-R0.1-SNAPSHOT</version>
|
<version>1.16.1-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- lang3 -->
|
<!-- lang3 -->
|
||||||
|
|
|
@ -57,10 +57,11 @@ public class Element {
|
||||||
public static final SubElement SAND = new SubElement("Sand", EARTH);
|
public static final SubElement SAND = new SubElement("Sand", EARTH);
|
||||||
public static final SubElement LIGHTNING = new SubElement("Lightning", FIRE);
|
public static final SubElement LIGHTNING = new SubElement("Lightning", FIRE);
|
||||||
public static final SubElement COMBUSTION = new SubElement("Combustion", FIRE);
|
public static final SubElement COMBUSTION = new SubElement("Combustion", FIRE);
|
||||||
|
public static final SubElement BLUE_FIRE = new SubElement("BlueFire", FIRE);
|
||||||
|
|
||||||
private static final Element[] ELEMENTS = { AIR, WATER, EARTH, FIRE, CHI, FLIGHT, SPIRITUAL, BLOOD, HEALING, ICE, PLANT, LAVA, METAL, SAND, LIGHTNING, COMBUSTION };
|
private static final Element[] ELEMENTS = { AIR, WATER, EARTH, FIRE, CHI, FLIGHT, SPIRITUAL, BLOOD, HEALING, ICE, PLANT, LAVA, METAL, SAND, LIGHTNING, COMBUSTION, BLUE_FIRE };
|
||||||
private static final Element[] MAIN_ELEMENTS = { AIR, WATER, EARTH, FIRE, CHI };
|
private static final Element[] MAIN_ELEMENTS = { AIR, WATER, EARTH, FIRE, CHI };
|
||||||
private static final SubElement[] SUB_ELEMENTS = { FLIGHT, SPIRITUAL, BLOOD, HEALING, ICE, PLANT, LAVA, METAL, SAND, LIGHTNING, COMBUSTION };
|
private static final SubElement[] SUB_ELEMENTS = { FLIGHT, SPIRITUAL, BLOOD, HEALING, ICE, PLANT, LAVA, METAL, SAND, LIGHTNING, COMBUSTION, BLUE_FIRE };
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private final ElementType type;
|
private final ElementType type;
|
||||||
|
@ -139,7 +140,7 @@ public class Element {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return this.getColor() + this.getName();
|
return (this == Element.BLUE_FIRE) ? this.getColor() + "Blue Fire": this.getColor() + this.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Element getElement(final String name) {
|
public static Element getElement(final String name) {
|
||||||
|
|
|
@ -157,6 +157,7 @@ public class GeneralMethods {
|
||||||
|
|
||||||
private static Method getAbsorption;
|
private static Method getAbsorption;
|
||||||
private static Method setAbsorption;
|
private static Method setAbsorption;
|
||||||
|
private static Method getHandle;
|
||||||
|
|
||||||
public GeneralMethods(final ProjectKorra plugin) {
|
public GeneralMethods(final ProjectKorra plugin) {
|
||||||
GeneralMethods.plugin = plugin;
|
GeneralMethods.plugin = plugin;
|
||||||
|
@ -164,6 +165,7 @@ public class GeneralMethods {
|
||||||
try {
|
try {
|
||||||
getAbsorption = ReflectionHandler.getMethod("EntityHuman", PackageType.MINECRAFT_SERVER, "getAbsorptionHearts");
|
getAbsorption = ReflectionHandler.getMethod("EntityHuman", PackageType.MINECRAFT_SERVER, "getAbsorptionHearts");
|
||||||
setAbsorption = ReflectionHandler.getMethod("EntityHuman", PackageType.MINECRAFT_SERVER, "setAbsorptionHearts", Float.class);
|
setAbsorption = ReflectionHandler.getMethod("EntityHuman", PackageType.MINECRAFT_SERVER, "setAbsorptionHearts", Float.class);
|
||||||
|
getHandle = ReflectionHandler.getMethod("CraftPlayer", PackageType.CRAFTBUKKIT_ENTITY, "getHandle");
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -462,6 +464,10 @@ public class GeneralMethods {
|
||||||
if (split[0].contains("p")) {
|
if (split[0].contains("p")) {
|
||||||
subelements.add(Element.PLANT);
|
subelements.add(Element.PLANT);
|
||||||
}
|
}
|
||||||
|
if (split[0].contains("r")) {
|
||||||
|
subelements.add(Element.BLUE_FIRE);
|
||||||
|
}
|
||||||
|
|
||||||
if (hasAddon) {
|
if (hasAddon) {
|
||||||
final CopyOnWriteArrayList<String> addonClone = new CopyOnWriteArrayList<String>(Arrays.asList(split[split.length - 1].split(",")));
|
final CopyOnWriteArrayList<String> addonClone = new CopyOnWriteArrayList<String>(Arrays.asList(split[split.length - 1].split(",")));
|
||||||
final long startTime = System.currentTimeMillis();
|
final long startTime = System.currentTimeMillis();
|
||||||
|
@ -672,7 +678,7 @@ public class GeneralMethods {
|
||||||
public static float getAbsorbationHealth(final Player player) {
|
public static float getAbsorbationHealth(final Player player) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final Object entityplayer = ActionBar.getHandle.invoke(player);
|
final Object entityplayer = getHandle.invoke(player);
|
||||||
final Object hearts = getAbsorption.invoke(entityplayer);
|
final Object hearts = getAbsorption.invoke(entityplayer);
|
||||||
return (float) hearts;
|
return (float) hearts;
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
|
@ -684,7 +690,7 @@ public class GeneralMethods {
|
||||||
public static void setAbsorbationHealth(final Player player, final float hearts) {
|
public static void setAbsorbationHealth(final Player player, final float hearts) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final Object entityplayer = ActionBar.getHandle.invoke(player);
|
final Object entityplayer = getHandle.invoke(player);
|
||||||
setAbsorption.invoke(entityplayer, hearts);
|
setAbsorption.invoke(entityplayer, hearts);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -863,7 +869,7 @@ public class GeneralMethods {
|
||||||
}
|
}
|
||||||
return circleblocks;
|
return circleblocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the closest entity within the specified radius around a point
|
* Gets the closest entity within the specified radius around a point
|
||||||
* @param center point to check around
|
* @param center point to check around
|
||||||
|
@ -873,10 +879,10 @@ public class GeneralMethods {
|
||||||
public static Entity getClosestEntity(Location center, double radius) {
|
public static Entity getClosestEntity(Location center, double radius) {
|
||||||
Entity found = null;
|
Entity found = null;
|
||||||
Double distance = null;
|
Double distance = null;
|
||||||
|
|
||||||
for (Entity entity : GeneralMethods.getEntitiesAroundPoint(center, radius)) {
|
for (Entity entity : GeneralMethods.getEntitiesAroundPoint(center, radius)) {
|
||||||
double check = center.distanceSquared(entity.getLocation());
|
double check = center.distanceSquared(entity.getLocation());
|
||||||
|
|
||||||
if (distance == null || check < distance) {
|
if (distance == null || check < distance) {
|
||||||
found = entity;
|
found = entity;
|
||||||
distance = check;
|
distance = check;
|
||||||
|
@ -885,7 +891,7 @@ public class GeneralMethods {
|
||||||
|
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the closest LivingEntity within the specified radius around a point
|
* Gets the closest LivingEntity within the specified radius around a point
|
||||||
* @param center point to check around
|
* @param center point to check around
|
||||||
|
@ -895,16 +901,16 @@ public class GeneralMethods {
|
||||||
public static LivingEntity getClosestLivingEntity(Location center, double radius) {
|
public static LivingEntity getClosestLivingEntity(Location center, double radius) {
|
||||||
LivingEntity le = null;
|
LivingEntity le = null;
|
||||||
Double distance = null;
|
Double distance = null;
|
||||||
|
|
||||||
for (Entity entity : GeneralMethods.getEntitiesAroundPoint(center, radius)) {
|
for (Entity entity : GeneralMethods.getEntitiesAroundPoint(center, radius)) {
|
||||||
double check = center.distanceSquared(entity.getLocation());
|
double check = center.distanceSquared(entity.getLocation());
|
||||||
|
|
||||||
if (entity instanceof LivingEntity && (distance == null || check < distance)) {
|
if (entity instanceof LivingEntity && (distance == null || check < distance)) {
|
||||||
le = (LivingEntity) entity;
|
le = (LivingEntity) entity;
|
||||||
distance = check;
|
distance = check;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return le;
|
return le;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1187,7 +1193,7 @@ public class GeneralMethods {
|
||||||
public static Entity getTargetedEntity(final Player player, final double range) {
|
public static Entity getTargetedEntity(final Player player, final double range) {
|
||||||
return getTargetedEntity(player, range, new ArrayList<Entity>());
|
return getTargetedEntity(player, range, new ArrayList<Entity>());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Location getTargetedLocation(final Player player, final double range, final boolean ignoreTempBlocks, final boolean checkDiagonals, final Material... nonOpaque2) {
|
public static Location getTargetedLocation(final Player player, final double range, final boolean ignoreTempBlocks, final boolean checkDiagonals, final Material... nonOpaque2) {
|
||||||
final Location origin = player.getEyeLocation();
|
final Location origin = player.getEyeLocation();
|
||||||
final Vector direction = origin.getDirection();
|
final Vector direction = origin.getDirection();
|
||||||
|
@ -1208,7 +1214,7 @@ public class GeneralMethods {
|
||||||
|
|
||||||
for (double i = 0; i < range; i += 0.2) {
|
for (double i = 0; i < range; i += 0.2) {
|
||||||
location.add(vec);
|
location.add(vec);
|
||||||
|
|
||||||
if (checkDiagonals && checkDiagonalWall(location, vec)) {
|
if (checkDiagonals && checkDiagonalWall(location, vec)) {
|
||||||
location.subtract(vec);
|
location.subtract(vec);
|
||||||
break;
|
break;
|
||||||
|
@ -1653,7 +1659,7 @@ public class GeneralMethods {
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (entity.getType()) {
|
switch (entity.getType()) {
|
||||||
case SKELETON:
|
case SKELETON:
|
||||||
case STRAY:
|
case STRAY:
|
||||||
|
@ -1662,7 +1668,8 @@ public class GeneralMethods {
|
||||||
case ZOMBIE:
|
case ZOMBIE:
|
||||||
case HUSK:
|
case HUSK:
|
||||||
case ZOMBIE_VILLAGER:
|
case ZOMBIE_VILLAGER:
|
||||||
case PIG_ZOMBIE:
|
case ZOMBIFIED_PIGLIN:
|
||||||
|
case ZOGLIN:
|
||||||
case DROWNED:
|
case DROWNED:
|
||||||
case ZOMBIE_HORSE:
|
case ZOMBIE_HORSE:
|
||||||
case SKELETON_HORSE:
|
case SKELETON_HORSE:
|
||||||
|
@ -2118,6 +2125,9 @@ public class GeneralMethods {
|
||||||
if (bPlayer.hasSubElement(Element.PLANT)) {
|
if (bPlayer.hasSubElement(Element.PLANT)) {
|
||||||
subs.append("p");
|
subs.append("p");
|
||||||
}
|
}
|
||||||
|
if (bPlayer.hasSubElement(Element.BLUE_FIRE)) {
|
||||||
|
subs.append("r");
|
||||||
|
}
|
||||||
boolean hasAddon = false;
|
boolean hasAddon = false;
|
||||||
for (final Element element : bPlayer.getSubElements()) {
|
for (final Element element : bPlayer.getSubElements()) {
|
||||||
if (Arrays.asList(Element.getAddonSubElements()).contains(element)) {
|
if (Arrays.asList(Element.getAddonSubElements()).contains(element)) {
|
||||||
|
@ -2344,6 +2354,19 @@ public class GeneralMethods {
|
||||||
case MAGMA_BLOCK:
|
case MAGMA_BLOCK:
|
||||||
case LAVA:
|
case LAVA:
|
||||||
case JACK_O_LANTERN:
|
case JACK_O_LANTERN:
|
||||||
|
case CRYING_OBSIDIAN:
|
||||||
|
case SHROOMLIGHT:
|
||||||
|
case CAMPFIRE:
|
||||||
|
case SOUL_CAMPFIRE:
|
||||||
|
case SOUL_TORCH:
|
||||||
|
case LANTERN:
|
||||||
|
case SOUL_LANTERN:
|
||||||
|
case CONDUIT:
|
||||||
|
case RESPAWN_ANCHOR:
|
||||||
|
case BROWN_MUSHROOM:
|
||||||
|
case BREWING_STAND:
|
||||||
|
case ENDER_CHEST:
|
||||||
|
case END_PORTAL_FRAME:
|
||||||
case END_ROD:
|
case END_ROD:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -143,7 +143,6 @@ import com.projectkorra.projectkorra.event.HorizontalVelocityChangeEvent;
|
||||||
import com.projectkorra.projectkorra.event.PlayerChangeElementEvent;
|
import com.projectkorra.projectkorra.event.PlayerChangeElementEvent;
|
||||||
import com.projectkorra.projectkorra.event.PlayerJumpEvent;
|
import com.projectkorra.projectkorra.event.PlayerJumpEvent;
|
||||||
import com.projectkorra.projectkorra.firebending.Blaze;
|
import com.projectkorra.projectkorra.firebending.Blaze;
|
||||||
import com.projectkorra.projectkorra.firebending.BlazeArc;
|
|
||||||
import com.projectkorra.projectkorra.firebending.BlazeRing;
|
import com.projectkorra.projectkorra.firebending.BlazeRing;
|
||||||
import com.projectkorra.projectkorra.firebending.FireBlast;
|
import com.projectkorra.projectkorra.firebending.FireBlast;
|
||||||
import com.projectkorra.projectkorra.firebending.FireBlastCharged;
|
import com.projectkorra.projectkorra.firebending.FireBlastCharged;
|
||||||
|
@ -372,10 +371,6 @@ public class PKListener implements Listener {
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
event.setCancelled(!Torrent.canThaw(block));
|
event.setCancelled(!Torrent.canThaw(block));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BlazeArc.getIgnitedBlocks().containsKey(block)) {
|
|
||||||
BlazeArc.removeBlock(block);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
|
@ -477,8 +472,8 @@ public class PKListener implements Listener {
|
||||||
public void onEntityCombust(final EntityCombustEvent event) {
|
public void onEntityCombust(final EntityCombustEvent event) {
|
||||||
final Entity entity = event.getEntity();
|
final Entity entity = event.getEntity();
|
||||||
final Block block = entity.getLocation().getBlock();
|
final Block block = entity.getLocation().getBlock();
|
||||||
if (BlazeArc.getIgnitedBlocks().containsKey(block) && entity instanceof LivingEntity) {
|
if (FireAbility.getSourcePlayers().containsKey(block) && entity instanceof LivingEntity) {
|
||||||
new FireDamageTimer(entity, BlazeArc.getIgnitedBlocks().get(block));
|
new FireDamageTimer(entity, FireAbility.getSourcePlayers().get(block));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -504,8 +499,8 @@ public class PKListener implements Listener {
|
||||||
public void onEntityDamageEvent(final EntityDamageEvent event) {
|
public void onEntityDamageEvent(final EntityDamageEvent event) {
|
||||||
final Entity entity = event.getEntity();
|
final Entity entity = event.getEntity();
|
||||||
|
|
||||||
if (event.getCause() == DamageCause.FIRE && BlazeArc.getIgnitedBlocks().containsKey(entity.getLocation().getBlock())) {
|
if (event.getCause() == DamageCause.FIRE && FireAbility.getSourcePlayers().containsKey(entity.getLocation().getBlock())) {
|
||||||
new FireDamageTimer(entity, BlazeArc.getIgnitedBlocks().get(entity.getLocation().getBlock()));
|
new FireDamageTimer(entity, FireAbility.getSourcePlayers().get(entity.getLocation().getBlock()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FireDamageTimer.isEnflamed(entity) && event.getCause() == DamageCause.FIRE_TICK) {
|
if (FireDamageTimer.isEnflamed(entity) && event.getCause() == DamageCause.FIRE_TICK) {
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.projectkorra.projectkorra.ability;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.projectkorra.projectkorra.Element;
|
||||||
|
|
||||||
|
public abstract class BlueFireAbility extends FireAbility implements SubAbility {
|
||||||
|
|
||||||
|
public BlueFireAbility(final Player player) {
|
||||||
|
super(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends Ability> getParentAbility() {
|
||||||
|
return FireAbility.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Element getElement() {
|
||||||
|
return Element.BLUE_FIRE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double getDamageFactor() {
|
||||||
|
return getConfig().getDouble("Properties.Fire.BlueFire.DamageFactor");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double getCooldownFactor() {
|
||||||
|
return getConfig().getDouble("Properties.Fire.BlueFire.CooldownFactor");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double getRangeFactor() {
|
||||||
|
return getConfig().getDouble("Properties.Fire.BlueFire.RangeFactor");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -80,6 +80,14 @@ public abstract class ElementalAbility extends CoreAbility {
|
||||||
public static boolean isEarth(final Material material) {
|
public static boolean isEarth(final Material material) {
|
||||||
return getConfig().getStringList("Properties.Earth.EarthBlocks").contains(material.toString());
|
return getConfig().getStringList("Properties.Earth.EarthBlocks").contains(material.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isFire(final Block block) {
|
||||||
|
return block != null ? isFire(block.getType()) : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isFire(final Material material) {
|
||||||
|
return material == Material.SOUL_FIRE || material == Material.FIRE;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isFullMoon(final World world) {
|
public static boolean isFullMoon(final World world) {
|
||||||
final double days = Math.ceil(world.getFullTime() / 24000) + 1;
|
final double days = Math.ceil(world.getFullTime() / 24000) + 1;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.projectkorra.projectkorra.ability;
|
package com.projectkorra.projectkorra.ability;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
@ -13,21 +13,21 @@ import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.Element;
|
import com.projectkorra.projectkorra.Element;
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
import com.projectkorra.projectkorra.ProjectKorra;
|
import com.projectkorra.projectkorra.ProjectKorra;
|
||||||
|
import com.projectkorra.projectkorra.Element.SubElement;
|
||||||
import com.projectkorra.projectkorra.ability.util.Collision;
|
import com.projectkorra.projectkorra.ability.util.Collision;
|
||||||
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
||||||
import com.projectkorra.projectkorra.firebending.BlazeArc;
|
|
||||||
import com.projectkorra.projectkorra.util.Information;
|
|
||||||
import com.projectkorra.projectkorra.util.ParticleEffect;
|
import com.projectkorra.projectkorra.util.ParticleEffect;
|
||||||
|
import com.projectkorra.projectkorra.util.TempBlock;
|
||||||
|
|
||||||
public abstract class FireAbility extends ElementalAbility {
|
public abstract class FireAbility extends ElementalAbility {
|
||||||
|
|
||||||
private static final Map<Location, Information> TEMP_FIRE = new ConcurrentHashMap<Location, Information>();
|
private static final Map<Block, Player> SOURCE_PLAYERS = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
public FireAbility(final Player player) {
|
public FireAbility(final Player player) {
|
||||||
super(player);
|
super(player);
|
||||||
|
@ -52,10 +52,17 @@ public abstract class FireAbility extends ElementalAbility {
|
||||||
public void handleCollision(final Collision collision) {
|
public void handleCollision(final Collision collision) {
|
||||||
super.handleCollision(collision);
|
super.handleCollision(collision);
|
||||||
if (collision.isRemovingFirst()) {
|
if (collision.isRemovingFirst()) {
|
||||||
ParticleEffect.BLOCK_CRACK.display(collision.getLocationFirst(), 10, 1, 1, 1, 0.1, Material.FIRE.createBlockData());
|
ParticleEffect.BLOCK_CRACK.display(collision.getLocationFirst(), 10, 1, 1, 1, 0.1, getFireType().createBlockData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return Material based on whether the player is a Blue Firebender, SOUL_FIRE if true, FIRE if false.
|
||||||
|
*/
|
||||||
|
public Material getFireType() {
|
||||||
|
return getBendingPlayer().canUseSubElement(SubElement.BLUE_FIRE) ? Material.SOUL_FIRE : Material.FIRE;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns if fire is allowed to completely replace blocks or if it should
|
* Returns if fire is allowed to completely replace blocks or if it should
|
||||||
* place a temp fire block.
|
* place a temp fire block.
|
||||||
|
@ -68,23 +75,15 @@ public abstract class FireAbility extends ElementalAbility {
|
||||||
* Creates a fire block meant to replace other blocks but reverts when the
|
* Creates a fire block meant to replace other blocks but reverts when the
|
||||||
* fire dissipates or is destroyed.
|
* fire dissipates or is destroyed.
|
||||||
*/
|
*/
|
||||||
public static void createTempFire(final Location loc) {
|
public void createTempFire(final Location loc) {
|
||||||
if (ElementalAbility.isAir(loc.getBlock().getType())) {
|
createTempFire(loc, getConfig().getLong("Properties.Fire.RevertTicks") + (long) ((new Random()).nextDouble() * getConfig().getLong("Properties.Fire.RevertTicks")));
|
||||||
loc.getBlock().setType(Material.FIRE);
|
}
|
||||||
return;
|
|
||||||
|
public void createTempFire(final Location loc, final long time) {
|
||||||
|
if(isIgnitable(loc.getBlock())) {
|
||||||
|
new TempBlock(loc.getBlock(), getFireType().createBlockData(), time);
|
||||||
|
SOURCE_PLAYERS.put(loc.getBlock(), this.getPlayer());
|
||||||
}
|
}
|
||||||
Information info = new Information();
|
|
||||||
final long time = getConfig().getLong("Properties.Fire.RevertTicks") + (long) ((new Random()).nextDouble() * getConfig().getLong("Properties.Fire.RevertTicks"));
|
|
||||||
if (TEMP_FIRE.containsKey(loc)) {
|
|
||||||
info = TEMP_FIRE.get(loc);
|
|
||||||
} else {
|
|
||||||
info.setBlock(loc.getBlock());
|
|
||||||
info.setLocation(loc);
|
|
||||||
info.setState(loc.getBlock().getState());
|
|
||||||
}
|
|
||||||
info.setTime(time + System.currentTimeMillis());
|
|
||||||
loc.getBlock().setType(Material.FIRE);
|
|
||||||
TEMP_FIRE.put(loc, info);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getDayFactor(final double value) {
|
public double getDayFactor(final double value) {
|
||||||
|
@ -118,7 +117,7 @@ public abstract class FireAbility extends ElementalAbility {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isIgnitable(final Block block) {
|
public static boolean isIgnitable(final Block block) {
|
||||||
return block != null ? isIgnitable(block.getType()) : false;
|
return (isIgnitable(block.getType()) && Arrays.asList(getTransparentMaterials()).contains(block.getType())) || (GeneralMethods.isSolid(block.getRelative(BlockFace.DOWN)) && isAir(block.getType()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isIgnitable(final Material material) {
|
public static boolean isIgnitable(final Material material) {
|
||||||
|
@ -147,7 +146,6 @@ public abstract class FireAbility extends ElementalAbility {
|
||||||
final float pitch = (float) getConfig().getDouble("Properties.Fire.CombustionSound.Pitch");
|
final float pitch = (float) getConfig().getDouble("Properties.Fire.CombustionSound.Pitch");
|
||||||
|
|
||||||
Sound sound = Sound.ENTITY_FIREWORK_ROCKET_BLAST;
|
Sound sound = Sound.ENTITY_FIREWORK_ROCKET_BLAST;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
sound = Sound.valueOf(getConfig().getString("Properties.Fire.CombustionSound.Sound"));
|
sound = Sound.valueOf(getConfig().getString("Properties.Fire.CombustionSound.Sound"));
|
||||||
} catch (final IllegalArgumentException exception) {
|
} catch (final IllegalArgumentException exception) {
|
||||||
|
@ -158,8 +156,12 @@ public abstract class FireAbility extends ElementalAbility {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void playFirebendingParticles(final Location loc, final int amount, final double xOffset, final double yOffset, final double zOffset) {
|
public void playFirebendingParticles(final Location loc, final int amount, final double xOffset, final double yOffset, final double zOffset) {
|
||||||
ParticleEffect.FLAME.display(loc, amount, xOffset, yOffset, zOffset);
|
if (this.getBendingPlayer().canUseSubElement(SubElement.BLUE_FIRE)) {
|
||||||
|
ParticleEffect.SOUL_FIRE_FLAME.display(loc, amount, xOffset, yOffset, zOffset);
|
||||||
|
} else {
|
||||||
|
ParticleEffect.FLAME.display(loc, amount, xOffset, yOffset, zOffset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void playFirebendingSound(final Location loc) {
|
public static void playFirebendingSound(final Location loc) {
|
||||||
|
@ -168,7 +170,6 @@ public abstract class FireAbility extends ElementalAbility {
|
||||||
final float pitch = (float) getConfig().getDouble("Properties.Fire.FireSound.Pitch");
|
final float pitch = (float) getConfig().getDouble("Properties.Fire.FireSound.Pitch");
|
||||||
|
|
||||||
Sound sound = Sound.BLOCK_FIRE_AMBIENT;
|
Sound sound = Sound.BLOCK_FIRE_AMBIENT;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
sound = Sound.valueOf(getConfig().getString("Properties.Fire.FireSound.Sound"));
|
sound = Sound.valueOf(getConfig().getString("Properties.Fire.FireSound.Sound"));
|
||||||
} catch (final IllegalArgumentException exception) {
|
} catch (final IllegalArgumentException exception) {
|
||||||
|
@ -193,7 +194,6 @@ public abstract class FireAbility extends ElementalAbility {
|
||||||
final float pitch = (float) getConfig().getDouble("Properties.Fire.LightningSound.Pitch");
|
final float pitch = (float) getConfig().getDouble("Properties.Fire.LightningSound.Pitch");
|
||||||
|
|
||||||
Sound sound = Sound.ENTITY_CREEPER_HURT;
|
Sound sound = Sound.ENTITY_CREEPER_HURT;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
sound = Sound.valueOf(getConfig().getString("Properties.Fire.LightningSound.Sound"));
|
sound = Sound.valueOf(getConfig().getString("Properties.Fire.LightningSound.Sound"));
|
||||||
} catch (final IllegalArgumentException exception) {
|
} catch (final IllegalArgumentException exception) {
|
||||||
|
@ -203,48 +203,13 @@ public abstract class FireAbility extends ElementalAbility {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Removes all temp fire that no longer needs to be there */
|
|
||||||
public static void removeFire() {
|
|
||||||
final Iterator<Location> it = TEMP_FIRE.keySet().iterator();
|
|
||||||
while (it.hasNext()) {
|
|
||||||
final Location loc = it.next();
|
|
||||||
final Information info = TEMP_FIRE.get(loc);
|
|
||||||
if (info.getLocation().getBlock().getType() != Material.FIRE && !ElementalAbility.isAir(info.getLocation().getBlock().getType())) {
|
|
||||||
revertTempFire(loc);
|
|
||||||
} else if (ElementalAbility.isAir(info.getBlock().getType()) || System.currentTimeMillis() > info.getTime()) {
|
|
||||||
revertTempFire(loc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Revert the temp fire at the location if any is there.
|
|
||||||
*
|
|
||||||
* @param location The Location
|
|
||||||
*/
|
|
||||||
public static void revertTempFire(final Location location) {
|
|
||||||
if (!TEMP_FIRE.containsKey(location)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final Information info = TEMP_FIRE.get(location);
|
|
||||||
if (info.getLocation().getBlock().getType() != Material.FIRE && !ElementalAbility.isAir(info.getLocation().getBlock().getType())) {
|
|
||||||
if (info.getState().getType().isBurnable() && !info.getState().getType().isOccluding()) {
|
|
||||||
final ItemStack itemStack = new ItemStack(info.getState().getType(), 1);
|
|
||||||
info.getState().getBlock().getWorld().dropItemNaturally(info.getLocation(), itemStack);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
info.getBlock().setType(info.getState().getType());
|
|
||||||
info.getBlock().setBlockData(info.getState().getBlockData());
|
|
||||||
}
|
|
||||||
TEMP_FIRE.remove(location);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void stopBending() {
|
public static void stopBending() {
|
||||||
BlazeArc.removeAllCleanup();
|
SOURCE_PLAYERS.clear();
|
||||||
for (final Location loc : TEMP_FIRE.keySet()) {
|
}
|
||||||
revertTempFire(loc);
|
|
||||||
}
|
public static Map<Block, Player> getSourcePlayers() {
|
||||||
|
return SOURCE_PLAYERS;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ import com.projectkorra.projectkorra.BendingPlayer;
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
import com.projectkorra.projectkorra.ProjectKorra;
|
import com.projectkorra.projectkorra.ProjectKorra;
|
||||||
import com.projectkorra.projectkorra.ability.AirAbility;
|
import com.projectkorra.projectkorra.ability.AirAbility;
|
||||||
|
import com.projectkorra.projectkorra.ability.FireAbility;
|
||||||
import com.projectkorra.projectkorra.ability.util.Collision;
|
import com.projectkorra.projectkorra.ability.util.Collision;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
import com.projectkorra.projectkorra.command.Commands;
|
import com.projectkorra.projectkorra.command.Commands;
|
||||||
|
@ -301,7 +302,7 @@ public class AirBlast extends AirAbility {
|
||||||
final Block block = this.location.getBlock();
|
final Block block = this.location.getBlock();
|
||||||
|
|
||||||
for (final Block testblock : GeneralMethods.getBlocksAroundPoint(this.location, this.radius)) {
|
for (final Block testblock : GeneralMethods.getBlocksAroundPoint(this.location, this.radius)) {
|
||||||
if (testblock.getType() == Material.FIRE) {
|
if (FireAbility.isFire(testblock.getType())) {
|
||||||
testblock.setType(Material.AIR);
|
testblock.setType(Material.AIR);
|
||||||
testblock.getWorld().playEffect(testblock.getLocation(), Effect.EXTINGUISH, 0);
|
testblock.getWorld().playEffect(testblock.getLocation(), Effect.EXTINGUISH, 0);
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -14,6 +14,7 @@ import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
import com.projectkorra.projectkorra.ability.AirAbility;
|
import com.projectkorra.projectkorra.ability.AirAbility;
|
||||||
|
import com.projectkorra.projectkorra.ability.FireAbility;
|
||||||
import com.projectkorra.projectkorra.ability.util.Collision;
|
import com.projectkorra.projectkorra.ability.util.Collision;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
import com.projectkorra.projectkorra.avatar.AvatarState;
|
import com.projectkorra.projectkorra.avatar.AvatarState;
|
||||||
|
@ -167,7 +168,7 @@ public class AirShield extends AirAbility {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (final Block testblock : GeneralMethods.getBlocksAroundPoint(this.player.getLocation(), this.radius)) {
|
for (final Block testblock : GeneralMethods.getBlocksAroundPoint(this.player.getLocation(), this.radius)) {
|
||||||
if (testblock.getType() == Material.FIRE) {
|
if (FireAbility.isFire(testblock.getType())) {
|
||||||
testblock.setType(Material.AIR);
|
testblock.setType(Material.AIR);
|
||||||
testblock.getWorld().playEffect(testblock.getLocation(), Effect.EXTINGUISH, 0);
|
testblock.getWorld().playEffect(testblock.getLocation(), Effect.EXTINGUISH, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ import com.projectkorra.projectkorra.ProjectKorra;
|
||||||
import com.projectkorra.projectkorra.ability.AirAbility;
|
import com.projectkorra.projectkorra.ability.AirAbility;
|
||||||
import com.projectkorra.projectkorra.ability.CoreAbility;
|
import com.projectkorra.projectkorra.ability.CoreAbility;
|
||||||
import com.projectkorra.projectkorra.ability.ElementalAbility;
|
import com.projectkorra.projectkorra.ability.ElementalAbility;
|
||||||
|
import com.projectkorra.projectkorra.ability.FireAbility;
|
||||||
import com.projectkorra.projectkorra.ability.util.Collision;
|
import com.projectkorra.projectkorra.ability.util.Collision;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
import com.projectkorra.projectkorra.command.Commands;
|
import com.projectkorra.projectkorra.command.Commands;
|
||||||
|
@ -157,7 +158,7 @@ public class AirSwipe extends AirAbility {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (final Block testblock : GeneralMethods.getBlocksAroundPoint(location, this.radius)) {
|
for (final Block testblock : GeneralMethods.getBlocksAroundPoint(location, this.radius)) {
|
||||||
if (testblock.getType() == Material.FIRE) {
|
if (FireAbility.isFire(testblock.getType())) {
|
||||||
testblock.setType(Material.AIR);
|
testblock.setType(Material.AIR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,7 @@ public class AddCommand extends PKCommand {
|
||||||
if (elements.length() > 1) {
|
if (elements.length() > 1) {
|
||||||
elements.append(ChatColor.YELLOW + ", ");
|
elements.append(ChatColor.YELLOW + ", ");
|
||||||
}
|
}
|
||||||
elements.append(e.getColor() + e.getName());
|
elements.append(e.toString());
|
||||||
|
|
||||||
bPlayer.getSubElements().clear();
|
bPlayer.getSubElements().clear();
|
||||||
for (final SubElement sub : Element.getAllSubElements()) {
|
for (final SubElement sub : Element.getAllSubElements()) {
|
||||||
|
@ -177,18 +177,18 @@ public class AddCommand extends PKCommand {
|
||||||
// send the message.
|
// send the message.
|
||||||
final ChatColor color = e.getColor();
|
final ChatColor color = e.getColor();
|
||||||
if (!(sender instanceof Player) || !((Player) sender).equals(target)) {
|
if (!(sender instanceof Player) || !((Player) sender).equals(target)) {
|
||||||
if (e != Element.AIR && e != Element.EARTH) {
|
if (e != Element.AIR && e != Element.EARTH && e != Element.BLUE_FIRE) {
|
||||||
GeneralMethods.sendBrandingMessage(sender, color + this.addedOtherCFW.replace("{target}", ChatColor.DARK_AQUA + target.getName() + color).replace("{element}", e.getName() + e.getType().getBender()));
|
GeneralMethods.sendBrandingMessage(sender, color + this.addedOtherCFW.replace("{target}", ChatColor.DARK_AQUA + target.getName() + color).replace("{element}", e.toString() + e.getType().getBender()));
|
||||||
GeneralMethods.sendBrandingMessage(target, color + this.addedCFW.replace("{element}", e.getName() + e.getType().getBender()));
|
GeneralMethods.sendBrandingMessage(target, color + this.addedCFW.replace("{element}", e.toString() + e.getType().getBender()));
|
||||||
} else {
|
} else {
|
||||||
GeneralMethods.sendBrandingMessage(sender, color + this.addedOtherAE.replace("{target}", ChatColor.DARK_AQUA + target.getName() + color).replace("{element}", e.getName() + e.getType().getBender()));
|
GeneralMethods.sendBrandingMessage(sender, color + this.addedOtherAE.replace("{target}", ChatColor.DARK_AQUA + target.getName() + color).replace("{element}", e.toString() + e.getType().getBender()));
|
||||||
GeneralMethods.sendBrandingMessage(target, color + this.addedAE.replace("{element}", e.getName() + e.getType().getBender()));
|
GeneralMethods.sendBrandingMessage(target, color + this.addedAE.replace("{element}", e.toString() + e.getType().getBender()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (e != Element.AIR && e != Element.EARTH) {
|
if (e != Element.AIR && e != Element.EARTH) {
|
||||||
GeneralMethods.sendBrandingMessage(target, color + this.addedCFW.replace("{element}", e.getName() + e.getType().getBender()));
|
GeneralMethods.sendBrandingMessage(target, color + this.addedCFW.replace("{element}", e.toString() + e.getType().getBender()));
|
||||||
} else {
|
} else {
|
||||||
GeneralMethods.sendBrandingMessage(target, color + this.addedAE.replace("{element}", e.getName() + e.getType().getBender()));
|
GeneralMethods.sendBrandingMessage(target, color + this.addedAE.replace("{element}", e.toString() + e.getType().getBender()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -213,16 +213,16 @@ public class AddCommand extends PKCommand {
|
||||||
|
|
||||||
if (!(sender instanceof Player) || !((Player) sender).equals(target)) {
|
if (!(sender instanceof Player) || !((Player) sender).equals(target)) {
|
||||||
if (e != Element.AIR && e != Element.EARTH) {
|
if (e != Element.AIR && e != Element.EARTH) {
|
||||||
GeneralMethods.sendBrandingMessage(sender, color + this.addedOtherCFW.replace("{target}", ChatColor.DARK_AQUA + target.getName() + color).replace("{element}", sub.getName() + sub.getType().getBender()));
|
GeneralMethods.sendBrandingMessage(sender, color + this.addedOtherCFW.replace("{target}", ChatColor.DARK_AQUA + target.getName() + color).replace("{element}", sub.toString() + sub.getType().getBender()));
|
||||||
} else {
|
} else {
|
||||||
GeneralMethods.sendBrandingMessage(sender, color + this.addedOtherAE.replace("{target}", ChatColor.DARK_AQUA + target.getName() + color).replace("{element}", sub.getName() + sub.getType().getBender()));
|
GeneralMethods.sendBrandingMessage(sender, color + this.addedOtherAE.replace("{target}", ChatColor.DARK_AQUA + target.getName() + color).replace("{element}", sub.toString() + sub.getType().getBender()));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (e != Element.AIR && e != Element.EARTH) {
|
if (e != Element.AIR && e != Element.EARTH) {
|
||||||
GeneralMethods.sendBrandingMessage(target, color + this.addedCFW.replace("{element}", sub.getName() + sub.getType().getBender()));
|
GeneralMethods.sendBrandingMessage(target, color + this.addedCFW.replace("{element}", sub.toString() + sub.getType().getBender()));
|
||||||
} else {
|
} else {
|
||||||
GeneralMethods.sendBrandingMessage(target, color + this.addedAE.replace("{element}", sub.getName() + sub.getType().getBender()));
|
GeneralMethods.sendBrandingMessage(target, color + this.addedAE.replace("{element}", sub.toString() + sub.getType().getBender()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GeneralMethods.saveSubElements(bPlayer);
|
GeneralMethods.saveSubElements(bPlayer);
|
||||||
|
@ -268,6 +268,7 @@ public class AddCommand extends PKCommand {
|
||||||
l.add("Plant");
|
l.add("Plant");
|
||||||
l.add("Sand");
|
l.add("Sand");
|
||||||
l.add("Spiritual");
|
l.add("Spiritual");
|
||||||
|
l.add("BlueFire");
|
||||||
for (final SubElement e : Element.getAddonSubElements()) {
|
for (final SubElement e : Element.getAddonSubElements()) {
|
||||||
l.add(e.getName());
|
l.add(e.getName());
|
||||||
}
|
}
|
||||||
|
|
|
@ -265,11 +265,11 @@ public class DisplayCommand extends PKCommand {
|
||||||
sender.sendMessage(ChatColor.YELLOW + "Combos: " + ChatColor.GOLD + "/bending display ChiCombos");
|
sender.sendMessage(ChatColor.YELLOW + "Combos: " + ChatColor.GOLD + "/bending display ChiCombos");
|
||||||
sender.sendMessage(ChatColor.YELLOW + "Passives: " + ChatColor.GOLD + "/bending display ChiPassives");
|
sender.sendMessage(ChatColor.YELLOW + "Passives: " + ChatColor.GOLD + "/bending display ChiPassives");
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage(element.getSubColor() + "Combos: " + element.getColor() + "/bending display " + element.getName() + "Combos");
|
sender.sendMessage(element.getSubColor() + "Combos: " + element.getColor() + "/bending display " + element.toString() + "Combos");
|
||||||
sender.sendMessage(element.getSubColor() + "Passives: " + element.getColor() + "/bending display " + element.getName() + "Passives");
|
sender.sendMessage(element.getSubColor() + "Passives: " + element.getColor() + "/bending display " + element.toString() + "Passives");
|
||||||
for (final SubElement sub : Element.getSubElements(element)) {
|
for (final SubElement sub : Element.getSubElements(element)) {
|
||||||
if (sender.hasPermission("bending." + element.getName().toLowerCase() + "." + sub.getName().toLowerCase())) {
|
if (sender.hasPermission("bending." + element.getName().toLowerCase() + "." + sub.getName().toLowerCase())) {
|
||||||
sender.sendMessage(sub.getColor() + sub.getName() + " abilities: " + element.getColor() + "/bending display " + sub.getName());
|
sender.sendMessage(sub.toString() + " abilities: " + element.getColor() + "/bending display " + sub.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -370,6 +370,7 @@ public class DisplayCommand extends PKCommand {
|
||||||
list.add("Plantbending");
|
list.add("Plantbending");
|
||||||
list.add("Sand");
|
list.add("Sand");
|
||||||
list.add("Spiritual");
|
list.add("Spiritual");
|
||||||
|
list.add("BlueFire");
|
||||||
|
|
||||||
for (final SubElement se : Element.getAddonSubElements()) {
|
for (final SubElement se : Element.getAddonSubElements()) {
|
||||||
list.add(se.getName());
|
list.add(se.getName());
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class RemoveCommand extends PKCommand {
|
||||||
senderBPlayer.getSubElements().remove(e);
|
senderBPlayer.getSubElements().remove(e);
|
||||||
GeneralMethods.saveSubElements(senderBPlayer);
|
GeneralMethods.saveSubElements(senderBPlayer);
|
||||||
GeneralMethods.removeUnusableAbilities(sender.getName());
|
GeneralMethods.removeUnusableAbilities(sender.getName());
|
||||||
GeneralMethods.sendBrandingMessage(sender, e.getColor() + this.succesfullyRemovedElementSelf.replace("{element}", e.getName() + e.getType().getBending()).replace("{sender}", ChatColor.DARK_AQUA + sender.getName() + e.getColor()));
|
GeneralMethods.sendBrandingMessage(sender, e.getColor() + this.succesfullyRemovedElementSelf.replace("{element}", e.toString() + e.getType().getBending()).replace("{sender}", ChatColor.DARK_AQUA + sender.getName() + e.getColor()));
|
||||||
Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeSubElementEvent(sender, player, (SubElement) e, com.projectkorra.projectkorra.event.PlayerChangeSubElementEvent.Result.REMOVE));
|
Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeSubElementEvent(sender, player, (SubElement) e, com.projectkorra.projectkorra.event.PlayerChangeSubElementEvent.Result.REMOVE));
|
||||||
} else {
|
} else {
|
||||||
GeneralMethods.sendBrandingMessage(sender, ChatColor.RED + this.wrongElementSelf);
|
GeneralMethods.sendBrandingMessage(sender, ChatColor.RED + this.wrongElementSelf);
|
||||||
|
@ -73,7 +73,7 @@ public class RemoveCommand extends PKCommand {
|
||||||
GeneralMethods.saveSubElements(senderBPlayer);
|
GeneralMethods.saveSubElements(senderBPlayer);
|
||||||
GeneralMethods.removeUnusableAbilities(sender.getName());
|
GeneralMethods.removeUnusableAbilities(sender.getName());
|
||||||
|
|
||||||
GeneralMethods.sendBrandingMessage(sender, e.getColor() + this.succesfullyRemovedElementSelf.replace("{element}", e.getName() + e.getType().getBending()));
|
GeneralMethods.sendBrandingMessage(sender, e.getColor() + this.succesfullyRemovedElementSelf.replace("{element}", e.toString() + e.getType().getBending()));
|
||||||
Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeElementEvent(sender, (Player) sender, e, Result.REMOVE));
|
Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeElementEvent(sender, (Player) sender, e, Result.REMOVE));
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
@ -123,8 +123,8 @@ public class RemoveCommand extends PKCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
GeneralMethods.removeUnusableAbilities(player.getName());
|
GeneralMethods.removeUnusableAbilities(player.getName());
|
||||||
GeneralMethods.sendBrandingMessage(player, e.getColor() + this.succesfullyRemovedElementTarget.replace("{element}", e.getName() + e.getType().getBending()).replace("{sender}", ChatColor.DARK_AQUA + sender.getName() + e.getColor()));
|
GeneralMethods.sendBrandingMessage(player, e.getColor() + this.succesfullyRemovedElementTarget.replace("{element}", e.toString() + e.getType().getBending()).replace("{sender}", ChatColor.DARK_AQUA + sender.getName() + e.getColor()));
|
||||||
GeneralMethods.sendBrandingMessage(sender, e.getColor() + this.succesfullyRemovedElementTargetConfirm.replace("{element}", e.getName() + e.getType().getBending()).replace("{target}", ChatColor.DARK_AQUA + player.getName() + e.getColor()));
|
GeneralMethods.sendBrandingMessage(sender, e.getColor() + this.succesfullyRemovedElementTargetConfirm.replace("{element}", e.toString() + e.getType().getBending()).replace("{target}", ChatColor.DARK_AQUA + player.getName() + e.getColor()));
|
||||||
Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeElementEvent(sender, player, e, Result.REMOVE));
|
Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeElementEvent(sender, player, e, Result.REMOVE));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -189,6 +189,7 @@ public class RemoveCommand extends PKCommand {
|
||||||
l.add("Plant");
|
l.add("Plant");
|
||||||
l.add("Sand");
|
l.add("Sand");
|
||||||
l.add("Spiritual");
|
l.add("Spiritual");
|
||||||
|
l.add("BlueFire");
|
||||||
|
|
||||||
for (final SubElement e : Element.getAddonSubElements()) {
|
for (final SubElement e : Element.getAddonSubElements()) {
|
||||||
l.add(e.getName());
|
l.add(e.getName());
|
||||||
|
|
|
@ -442,6 +442,8 @@ public class ConfigManager {
|
||||||
|
|
||||||
final ArrayList<String> earthBlocks = new ArrayList<String>();
|
final ArrayList<String> earthBlocks = new ArrayList<String>();
|
||||||
earthBlocks.add(Material.DIRT.toString());
|
earthBlocks.add(Material.DIRT.toString());
|
||||||
|
earthBlocks.add(Material.COARSE_DIRT.toString());
|
||||||
|
earthBlocks.add(Material.PODZOL.toString());
|
||||||
earthBlocks.add(Material.MYCELIUM.toString());
|
earthBlocks.add(Material.MYCELIUM.toString());
|
||||||
earthBlocks.add(Material.STONE.toString());
|
earthBlocks.add(Material.STONE.toString());
|
||||||
earthBlocks.add(Material.GRAVEL.toString());
|
earthBlocks.add(Material.GRAVEL.toString());
|
||||||
|
@ -460,14 +462,20 @@ public class ConfigManager {
|
||||||
earthBlocks.add(Material.ANDESITE.toString());
|
earthBlocks.add(Material.ANDESITE.toString());
|
||||||
earthBlocks.add(Material.GRANITE.toString());
|
earthBlocks.add(Material.GRANITE.toString());
|
||||||
earthBlocks.add(Material.DIORITE.toString());
|
earthBlocks.add(Material.DIORITE.toString());
|
||||||
|
earthBlocks.add(Material.BASALT.toString());
|
||||||
|
earthBlocks.add(Material.ANCIENT_DEBRIS.toString());
|
||||||
|
earthBlocks.add(Material.BLACKSTONE.toString());
|
||||||
|
|
||||||
final ArrayList<String> metalBlocks = new ArrayList<String>();
|
final ArrayList<String> metalBlocks = new ArrayList<String>();
|
||||||
metalBlocks.add(Material.IRON_ORE.toString());
|
metalBlocks.add(Material.IRON_ORE.toString());
|
||||||
metalBlocks.add(Material.GOLD_ORE.toString());
|
metalBlocks.add(Material.GOLD_ORE.toString());
|
||||||
metalBlocks.add(Material.NETHER_QUARTZ_ORE.toString());
|
metalBlocks.add(Material.NETHER_QUARTZ_ORE.toString());
|
||||||
|
earthBlocks.add(Material.GILDED_BLACKSTONE.toString());
|
||||||
metalBlocks.add(Material.IRON_BLOCK.toString());
|
metalBlocks.add(Material.IRON_BLOCK.toString());
|
||||||
metalBlocks.add(Material.GOLD_BLOCK.toString());
|
metalBlocks.add(Material.GOLD_BLOCK.toString());
|
||||||
metalBlocks.add(Material.QUARTZ_BLOCK.toString());
|
metalBlocks.add(Material.QUARTZ_BLOCK.toString());
|
||||||
|
metalBlocks.add(Material.CHAIN.toString());
|
||||||
|
metalBlocks.add(Material.NETHERITE_BLOCK.toString());
|
||||||
|
|
||||||
final ArrayList<String> sandBlocks = new ArrayList<String>();
|
final ArrayList<String> sandBlocks = new ArrayList<String>();
|
||||||
sandBlocks.add(Material.SAND.toString());
|
sandBlocks.add(Material.SAND.toString());
|
||||||
|
@ -512,12 +520,20 @@ public class ConfigManager {
|
||||||
plantBlocks.add(Material.SUNFLOWER.toString());
|
plantBlocks.add(Material.SUNFLOWER.toString());
|
||||||
plantBlocks.add(Material.POPPY.toString());
|
plantBlocks.add(Material.POPPY.toString());
|
||||||
plantBlocks.add(Material.FERN.toString());
|
plantBlocks.add(Material.FERN.toString());
|
||||||
|
plantBlocks.add(Material.LILY_OF_THE_VALLEY.toString());
|
||||||
|
plantBlocks.add(Material.WITHER_ROSE.toString());
|
||||||
|
plantBlocks.add(Material.CORNFLOWER.toString());
|
||||||
plantBlocks.add(Material.LARGE_FERN.toString());
|
plantBlocks.add(Material.LARGE_FERN.toString());
|
||||||
plantBlocks.add(Material.RED_MUSHROOM.toString());
|
plantBlocks.add(Material.RED_MUSHROOM.toString());
|
||||||
plantBlocks.add(Material.RED_MUSHROOM_BLOCK.toString());
|
plantBlocks.add(Material.RED_MUSHROOM_BLOCK.toString());
|
||||||
plantBlocks.add(Material.BROWN_MUSHROOM.toString());
|
plantBlocks.add(Material.BROWN_MUSHROOM.toString());
|
||||||
plantBlocks.add(Material.BROWN_MUSHROOM_BLOCK.toString());
|
plantBlocks.add(Material.BROWN_MUSHROOM_BLOCK.toString());
|
||||||
plantBlocks.add(Material.MUSHROOM_STEM.toString());
|
plantBlocks.add(Material.MUSHROOM_STEM.toString());
|
||||||
|
plantBlocks.add(Material.WARPED_ROOTS.toString());
|
||||||
|
plantBlocks.add(Material.CRIMSON_ROOTS.toString());
|
||||||
|
plantBlocks.add(Material.TWISTING_VINES_PLANT.toString());
|
||||||
|
plantBlocks.add(Material.WEEPING_VINES_PLANT.toString());
|
||||||
|
plantBlocks.add(Material.NETHER_SPROUTS.toString());
|
||||||
plantBlocks.add(Material.CACTUS.toString());
|
plantBlocks.add(Material.CACTUS.toString());
|
||||||
plantBlocks.add(Material.PUMPKIN.toString());
|
plantBlocks.add(Material.PUMPKIN.toString());
|
||||||
plantBlocks.add(Material.PUMPKIN_STEM.toString());
|
plantBlocks.add(Material.PUMPKIN_STEM.toString());
|
||||||
|
@ -633,7 +649,10 @@ public class ConfigManager {
|
||||||
config.addDefault("Properties.Fire.LightningSound.Sound", "ENTITY_CREEPER_HURT");
|
config.addDefault("Properties.Fire.LightningSound.Sound", "ENTITY_CREEPER_HURT");
|
||||||
config.addDefault("Properties.Fire.LightningSound.Volume", 1);
|
config.addDefault("Properties.Fire.LightningSound.Volume", 1);
|
||||||
config.addDefault("Properties.Fire.LightningSound.Pitch", 0);
|
config.addDefault("Properties.Fire.LightningSound.Pitch", 0);
|
||||||
|
config.addDefault("Properties.Fire.BlueFire.DamageFactor", 1.1);
|
||||||
|
config.addDefault("Properties.Fire.BlueFire.CooldownFactor", .9);
|
||||||
|
config.addDefault("Properties.Fire.BlueFire.RangeFactor", 1.2);
|
||||||
|
|
||||||
config.addDefault("Properties.Chi.CanBendWithWeapons", true);
|
config.addDefault("Properties.Chi.CanBendWithWeapons", true);
|
||||||
|
|
||||||
final ArrayList<String> disabledWorlds = new ArrayList<String>();
|
final ArrayList<String> disabledWorlds = new ArrayList<String>();
|
||||||
|
|
|
@ -1,19 +1,14 @@
|
||||||
package com.projectkorra.projectkorra.firebending;
|
package com.projectkorra.projectkorra.firebending;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.BlockState;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.BendingPlayer;
|
import com.projectkorra.projectkorra.Element.SubElement;
|
||||||
import com.projectkorra.projectkorra.Element;
|
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
|
import com.projectkorra.projectkorra.ability.BlueFireAbility;
|
||||||
import com.projectkorra.projectkorra.ability.FireAbility;
|
import com.projectkorra.projectkorra.ability.FireAbility;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
import com.projectkorra.projectkorra.waterbending.plant.PlantRegrowth;
|
import com.projectkorra.projectkorra.waterbending.plant.PlantRegrowth;
|
||||||
|
@ -21,9 +16,6 @@ import com.projectkorra.projectkorra.waterbending.plant.PlantRegrowth;
|
||||||
public class BlazeArc extends FireAbility {
|
public class BlazeArc extends FireAbility {
|
||||||
|
|
||||||
private static final long DISSIPATE_REMOVE_TIME = 400;
|
private static final long DISSIPATE_REMOVE_TIME = 400;
|
||||||
private static final Map<Block, Player> IGNITED_BLOCKS = new ConcurrentHashMap<>();
|
|
||||||
private static final Map<Block, Long> IGNITED_TIMES = new ConcurrentHashMap<>();
|
|
||||||
private static final Map<Location, BlockState> REPLACED_BLOCKS = new ConcurrentHashMap<>();
|
|
||||||
|
|
||||||
private long time;
|
private long time;
|
||||||
private long interval;
|
private long interval;
|
||||||
|
@ -39,7 +31,12 @@ public class BlazeArc extends FireAbility {
|
||||||
super(player);
|
super(player);
|
||||||
this.range = this.getDayFactor(range);
|
this.range = this.getDayFactor(range);
|
||||||
this.speed = getConfig().getLong("Abilities.Fire.Blaze.Speed");
|
this.speed = getConfig().getLong("Abilities.Fire.Blaze.Speed");
|
||||||
this.interval = (long) (1000. / this.speed);
|
this.interval = (long) (1000.0 / this.speed);
|
||||||
|
|
||||||
|
if(bPlayer.canUseSubElement(SubElement.BLUE_FIRE)) {
|
||||||
|
this.range += BlueFireAbility.getRangeFactor() * range - range;
|
||||||
|
}
|
||||||
|
|
||||||
this.origin = location.clone();
|
this.origin = location.clone();
|
||||||
this.location = this.origin.clone();
|
this.location = this.origin.clone();
|
||||||
|
|
||||||
|
@ -53,19 +50,17 @@ public class BlazeArc extends FireAbility {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ignite(final Block block) {
|
private void ignite(final Block block) {
|
||||||
if (block.getType() != Material.FIRE && !isAir(block.getType())) {
|
if (!isFire(block.getType()) && !isAir(block.getType())) {
|
||||||
if (canFireGrief()) {
|
if (canFireGrief()) {
|
||||||
if (isPlant(block) || isSnow(block)) {
|
if (isPlant(block) || isSnow(block)) {
|
||||||
new PlantRegrowth(this.player, block);
|
new PlantRegrowth(this.player, block);
|
||||||
}
|
}
|
||||||
} else if (block.getType() != Material.FIRE) {
|
|
||||||
REPLACED_BLOCKS.put(block.getLocation(), block.getState());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
block.setType(Material.FIRE);
|
if (isIgnitable(block)) {
|
||||||
IGNITED_BLOCKS.put(block, this.player);
|
createTempFire(block.getLocation(), DISSIPATE_REMOVE_TIME);
|
||||||
IGNITED_TIMES.put(block, System.currentTimeMillis());
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -78,10 +73,9 @@ public class BlazeArc extends FireAbility {
|
||||||
this.time = System.currentTimeMillis();
|
this.time = System.currentTimeMillis();
|
||||||
|
|
||||||
final Block block = this.location.getBlock();
|
final Block block = this.location.getBlock();
|
||||||
if (block.getType() == Material.FIRE) {
|
if (isFire(block.getType())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.location.distanceSquared(this.origin) > this.range * this.range) {
|
if (this.location.distanceSquared(this.origin) > this.range * this.range) {
|
||||||
this.remove();
|
this.remove();
|
||||||
return;
|
return;
|
||||||
|
@ -92,76 +86,26 @@ public class BlazeArc extends FireAbility {
|
||||||
final Block ignitable = getIgnitable(block);
|
final Block ignitable = getIgnitable(block);
|
||||||
if (ignitable != null) {
|
if (ignitable != null) {
|
||||||
this.ignite(ignitable);
|
this.ignite(ignitable);
|
||||||
|
int difference = ignitable.getY() - this.location.getBlockY();
|
||||||
|
this.location.add(0, difference, 0);
|
||||||
|
} else {
|
||||||
|
remove();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void dissipateAll() {
|
public Block getIgnitable(final Block block) {
|
||||||
if (DISSIPATE_REMOVE_TIME != 0) {
|
|
||||||
for (final Block block : IGNITED_TIMES.keySet()) {
|
Block[] blockArr = { block.getRelative(BlockFace.UP), block, block.getRelative(BlockFace.DOWN) };
|
||||||
if (block.getType() != Material.FIRE) {
|
|
||||||
removeBlock(block);
|
for (int i = 0; i < 3; i++) {
|
||||||
} else {
|
if (isFire(blockArr[i].getType()) || isIgnitable(blockArr[i])) {
|
||||||
final long time = IGNITED_TIMES.get(block);
|
return blockArr[i];
|
||||||
if (System.currentTimeMillis() > time + DISSIPATE_REMOVE_TIME) {
|
|
||||||
block.setType(Material.AIR);
|
|
||||||
removeBlock(block);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public static void handleDissipation() {
|
return null;
|
||||||
for (final Block block : IGNITED_BLOCKS.keySet()) {
|
|
||||||
if (block.getType() != Material.FIRE) {
|
|
||||||
IGNITED_BLOCKS.remove(block);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Block getIgnitable(final Block block) {
|
|
||||||
Block top = block;
|
|
||||||
|
|
||||||
for (int i = 0; i < 2; i++) {
|
|
||||||
if (GeneralMethods.isSolid(top.getRelative(BlockFace.DOWN))) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
top = top.getRelative(BlockFace.DOWN);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (top.getType() == Material.FIRE) {
|
|
||||||
return top;
|
|
||||||
} else if (top.getType().isBurnable()) {
|
|
||||||
return top;
|
|
||||||
} else if (isAir(top.getType())) {
|
|
||||||
return top;
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isIgnitable(final Player player, final Block block) {
|
|
||||||
if (!BendingPlayer.getBendingPlayer(player).hasElement(Element.FIRE)) {
|
|
||||||
return false;
|
|
||||||
} else if (!GeneralMethods.isSolid(block.getRelative(BlockFace.DOWN))) {
|
|
||||||
return false;
|
|
||||||
} else if (block.getType() == Material.FIRE) {
|
|
||||||
return true;
|
|
||||||
} else if (block.getType().isBurnable()) {
|
|
||||||
return true;
|
|
||||||
} else if (isAir(block.getType())) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void removeAllCleanup() {
|
|
||||||
for (final Block block : IGNITED_BLOCKS.keySet()) {
|
|
||||||
removeBlock(block);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removeAroundPoint(final Location location, final double radius) {
|
public static void removeAroundPoint(final Location location, final double radius) {
|
||||||
|
@ -174,20 +118,6 @@ public class BlazeArc extends FireAbility {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removeBlock(final Block block) {
|
|
||||||
if (IGNITED_BLOCKS.containsKey(block)) {
|
|
||||||
IGNITED_BLOCKS.remove(block);
|
|
||||||
}
|
|
||||||
if (IGNITED_TIMES.containsKey(block)) {
|
|
||||||
IGNITED_TIMES.remove(block);
|
|
||||||
}
|
|
||||||
if (REPLACED_BLOCKS.containsKey(block.getLocation())) {
|
|
||||||
block.setType(REPLACED_BLOCKS.get(block.getLocation()).getType());
|
|
||||||
block.setBlockData(REPLACED_BLOCKS.get(block.getLocation()).getBlockData());
|
|
||||||
REPLACED_BLOCKS.remove(block.getLocation());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "Blaze";
|
return "Blaze";
|
||||||
|
@ -268,18 +198,6 @@ public class BlazeArc extends FireAbility {
|
||||||
return DISSIPATE_REMOVE_TIME;
|
return DISSIPATE_REMOVE_TIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<Block, Player> getIgnitedBlocks() {
|
|
||||||
return IGNITED_BLOCKS;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Map<Block, Long> getIgnitedTimes() {
|
|
||||||
return IGNITED_TIMES;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Map<Location, BlockState> getReplacedBlocks() {
|
|
||||||
return REPLACED_BLOCKS;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLocation(final Location location) {
|
public void setLocation(final Location location) {
|
||||||
this.location = location;
|
this.location = location;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,12 @@ import java.util.Random;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.BlastFurnace;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.block.data.type.Campfire;
|
||||||
import org.bukkit.block.Furnace;
|
import org.bukkit.block.Furnace;
|
||||||
|
import org.bukkit.block.Smoker;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -16,7 +19,9 @@ import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
import com.projectkorra.projectkorra.ProjectKorra;
|
import com.projectkorra.projectkorra.ProjectKorra;
|
||||||
|
import com.projectkorra.projectkorra.Element.SubElement;
|
||||||
import com.projectkorra.projectkorra.ability.AirAbility;
|
import com.projectkorra.projectkorra.ability.AirAbility;
|
||||||
|
import com.projectkorra.projectkorra.ability.BlueFireAbility;
|
||||||
import com.projectkorra.projectkorra.ability.FireAbility;
|
import com.projectkorra.projectkorra.ability.FireAbility;
|
||||||
import com.projectkorra.projectkorra.ability.util.Collision;
|
import com.projectkorra.projectkorra.ability.util.Collision;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
|
@ -24,7 +29,6 @@ import com.projectkorra.projectkorra.avatar.AvatarState;
|
||||||
import com.projectkorra.projectkorra.command.Commands;
|
import com.projectkorra.projectkorra.command.Commands;
|
||||||
import com.projectkorra.projectkorra.firebending.util.FireDamageTimer;
|
import com.projectkorra.projectkorra.firebending.util.FireDamageTimer;
|
||||||
import com.projectkorra.projectkorra.util.DamageHandler;
|
import com.projectkorra.projectkorra.util.DamageHandler;
|
||||||
import com.projectkorra.projectkorra.util.ParticleEffect;
|
|
||||||
import com.projectkorra.projectkorra.waterbending.plant.PlantRegrowth;
|
import com.projectkorra.projectkorra.waterbending.plant.PlantRegrowth;
|
||||||
|
|
||||||
public class FireBlast extends FireAbility {
|
public class FireBlast extends FireAbility {
|
||||||
|
@ -53,7 +57,6 @@ public class FireBlast extends FireAbility {
|
||||||
@Attribute(Attribute.KNOCKBACK)
|
@Attribute(Attribute.KNOCKBACK)
|
||||||
private double knockback;
|
private double knockback;
|
||||||
private double flameRadius;
|
private double flameRadius;
|
||||||
private double smokeRadius;
|
|
||||||
private Random random;
|
private Random random;
|
||||||
private Location location;
|
private Location location;
|
||||||
private Location origin;
|
private Location origin;
|
||||||
|
@ -69,17 +72,17 @@ public class FireBlast extends FireAbility {
|
||||||
|
|
||||||
this.setFields();
|
this.setFields();
|
||||||
this.safeBlocks = safeBlocks;
|
this.safeBlocks = safeBlocks;
|
||||||
this.damage = damage;
|
|
||||||
|
|
||||||
this.location = location.clone();
|
this.location = location.clone();
|
||||||
this.origin = location.clone();
|
this.origin = location.clone();
|
||||||
this.direction = direction.clone().normalize();
|
this.direction = direction.clone().normalize();
|
||||||
this.range = this.getDayFactor(this.range);
|
|
||||||
this.damage = this.getDayFactor(damage);
|
// The following code determines the total additive modifier between Blue Fire & Day Modifiers
|
||||||
|
this.applyModifiers();
|
||||||
|
|
||||||
this.start();
|
this.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public FireBlast(final Player player) {
|
public FireBlast(final Player player) {
|
||||||
super(player);
|
super(player);
|
||||||
|
|
||||||
|
@ -91,18 +94,34 @@ public class FireBlast extends FireAbility {
|
||||||
|
|
||||||
this.setFields();
|
this.setFields();
|
||||||
this.isFireBurst = false;
|
this.isFireBurst = false;
|
||||||
this.damage = this.getDayFactor(getConfig().getDouble("Abilities.Fire.FireBlast.Damage"));
|
this.damage = getConfig().getDouble("Abilities.Fire.FireBlast.Damage");
|
||||||
this.safeBlocks = new ArrayList<>();
|
this.safeBlocks = new ArrayList<>();
|
||||||
this.range = this.getDayFactor(this.range);
|
|
||||||
this.location = player.getEyeLocation();
|
this.location = player.getEyeLocation();
|
||||||
this.origin = player.getEyeLocation();
|
this.origin = player.getEyeLocation();
|
||||||
this.direction = player.getEyeLocation().getDirection().normalize();
|
this.direction = player.getEyeLocation().getDirection().normalize();
|
||||||
this.location = this.location.add(this.direction.clone());
|
this.location = this.location.add(this.direction.clone());
|
||||||
|
|
||||||
|
// The following code determines the total additive modifier between Blue Fire & Day Modifiers
|
||||||
|
this.applyModifiers();
|
||||||
|
|
||||||
this.start();
|
this.start();
|
||||||
this.bPlayer.addCooldown("FireBlast", this.cooldown);
|
this.bPlayer.addCooldown("FireBlast", this.cooldown);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void applyModifiers() {
|
||||||
|
int damageMod = 0;
|
||||||
|
int rangeMod = 0;
|
||||||
|
|
||||||
|
damageMod = (int) (this.getDayFactor(damage) - damage);
|
||||||
|
rangeMod = (int) (this.getDayFactor(this.range) - this.range);
|
||||||
|
|
||||||
|
damageMod = (int) (bPlayer.canUseSubElement(SubElement.BLUE_FIRE) ? (BlueFireAbility.getDamageFactor() * damage - damage) + damageMod : damageMod);
|
||||||
|
rangeMod = (int) (bPlayer.canUseSubElement(SubElement.BLUE_FIRE) ? (BlueFireAbility.getRangeFactor() * range - range) + rangeMod : rangeMod);
|
||||||
|
|
||||||
|
this.range += rangeMod;
|
||||||
|
this.damage += damageMod;
|
||||||
|
}
|
||||||
|
|
||||||
private void setFields() {
|
private void setFields() {
|
||||||
this.isFireBurst = true;
|
this.isFireBurst = true;
|
||||||
this.powerFurnace = true;
|
this.powerFurnace = true;
|
||||||
|
@ -116,28 +135,25 @@ public class FireBlast extends FireAbility {
|
||||||
this.fireTicks = getConfig().getDouble("Abilities.Fire.FireBlast.FireTicks");
|
this.fireTicks = getConfig().getDouble("Abilities.Fire.FireBlast.FireTicks");
|
||||||
this.knockback = getConfig().getDouble("Abilities.Fire.FireBlast.Knockback");
|
this.knockback = getConfig().getDouble("Abilities.Fire.FireBlast.Knockback");
|
||||||
this.flameRadius = getConfig().getDouble("Abilities.Fire.FireBlast.FlameParticleRadius");
|
this.flameRadius = getConfig().getDouble("Abilities.Fire.FireBlast.FlameParticleRadius");
|
||||||
this.smokeRadius = getConfig().getDouble("Abilities.Fire.FireBlast.SmokeParticleRadius");
|
|
||||||
this.random = new Random();
|
this.random = new Random();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void advanceLocation() {
|
private void advanceLocation() {
|
||||||
if (this.isFireBurst) {
|
if (this.isFireBurst) {
|
||||||
this.flameRadius += 0.06;
|
this.flameRadius += 0.06;
|
||||||
this.smokeRadius += 0.06;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.showParticles) {
|
if (this.showParticles) {
|
||||||
ParticleEffect.FLAME.display(this.location, 6, this.flameRadius, this.flameRadius, this.flameRadius);
|
playFirebendingParticles(this.location, 6, this.flameRadius, this.flameRadius, this.flameRadius);
|
||||||
ParticleEffect.SMOKE_NORMAL.display(this.location, 3, this.smokeRadius, this.smokeRadius, this.smokeRadius);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GeneralMethods.checkDiagonalWall(this.location, this.direction)) {
|
if (GeneralMethods.checkDiagonalWall(this.location, this.direction)) {
|
||||||
this.remove();
|
this.remove();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.location = this.location.add(this.direction.clone().multiply(this.speedFactor));
|
this.location = this.location.add(this.direction.clone().multiply(this.speedFactor));
|
||||||
|
|
||||||
if (this.random.nextInt(4) == 0) {
|
if (this.random.nextInt(4) == 0) {
|
||||||
playFirebendingSound(this.location);
|
playFirebendingSound(this.location);
|
||||||
}
|
}
|
||||||
|
@ -162,20 +178,13 @@ public class FireBlast extends FireAbility {
|
||||||
|
|
||||||
private void ignite(final Location location) {
|
private void ignite(final Location location) {
|
||||||
for (final Block block : GeneralMethods.getBlocksAroundPoint(location, this.collisionRadius)) {
|
for (final Block block : GeneralMethods.getBlocksAroundPoint(location, this.collisionRadius)) {
|
||||||
if (BlazeArc.isIgnitable(this.player, block) && !this.safeBlocks.contains(block) && !GeneralMethods.isRegionProtectedFromBuild(this, block.getLocation())) {
|
if (isIgnitable(block) && !this.safeBlocks.contains(block) && !GeneralMethods.isRegionProtectedFromBuild(this, block.getLocation())) {
|
||||||
if (canFireGrief()) {
|
if (canFireGrief()) {
|
||||||
if (isPlant(block) || isSnow(block)) {
|
if (isPlant(block) || isSnow(block)) {
|
||||||
new PlantRegrowth(this.player, block);
|
new PlantRegrowth(this.player, block);
|
||||||
}
|
}
|
||||||
block.setType(Material.FIRE);
|
|
||||||
} else {
|
|
||||||
createTempFire(block.getLocation());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.dissipate) {
|
|
||||||
BlazeArc.getIgnitedBlocks().put(block, this.player);
|
|
||||||
BlazeArc.getIgnitedTimes().put(block, System.currentTimeMillis());
|
|
||||||
}
|
}
|
||||||
|
createTempFire(block.getLocation());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -200,9 +209,23 @@ public class FireBlast extends FireAbility {
|
||||||
if (block.getType() == Material.FURNACE && this.powerFurnace) {
|
if (block.getType() == Material.FURNACE && this.powerFurnace) {
|
||||||
final Furnace furnace = (Furnace) block.getState();
|
final Furnace furnace = (Furnace) block.getState();
|
||||||
furnace.setBurnTime((short) 800);
|
furnace.setBurnTime((short) 800);
|
||||||
furnace.setCookTime((short) 800);
|
|
||||||
furnace.update();
|
furnace.update();
|
||||||
} else if (BlazeArc.isIgnitable(this.player, block.getRelative(BlockFace.UP))) {
|
} else if (block.getType() == Material.SMOKER && this.powerFurnace) {
|
||||||
|
final Smoker smoker = (Smoker) block.getState();
|
||||||
|
smoker.setBurnTime((short) 800);
|
||||||
|
smoker.update();
|
||||||
|
} else if (block.getType() == Material.BLAST_FURNACE && this.powerFurnace) {
|
||||||
|
final BlastFurnace blastF = (BlastFurnace) block.getState();
|
||||||
|
blastF.setBurnTime((short) 800);
|
||||||
|
blastF.update();
|
||||||
|
} else if (block instanceof Campfire) {
|
||||||
|
final Campfire campfire = (Campfire) block.getBlockData();
|
||||||
|
if(!campfire.isLit()) {
|
||||||
|
if(block.getType() != Material.SOUL_CAMPFIRE || bPlayer.canUseSubElement(SubElement.BLUE_FIRE)) {
|
||||||
|
campfire.setLit(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (isIgnitable(block.getRelative(BlockFace.UP))) {
|
||||||
if ((this.isFireBurst && this.fireBurstIgnite) || !this.isFireBurst) {
|
if ((this.isFireBurst && this.fireBurstIgnite) || !this.isFireBurst) {
|
||||||
this.ignite(this.location);
|
this.ignite(this.location);
|
||||||
}
|
}
|
||||||
|
@ -433,5 +456,4 @@ public class FireBlast extends FireAbility {
|
||||||
this.isFireBurst = isFireBurst;
|
this.isFireBurst = isFireBurst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,7 @@ import java.util.Map;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.bukkit.Effect;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
|
@ -17,7 +15,9 @@ import org.bukkit.entity.TNTPrimed;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
|
import com.projectkorra.projectkorra.Element.SubElement;
|
||||||
import com.projectkorra.projectkorra.ability.AirAbility;
|
import com.projectkorra.projectkorra.ability.AirAbility;
|
||||||
|
import com.projectkorra.projectkorra.ability.BlueFireAbility;
|
||||||
import com.projectkorra.projectkorra.ability.CoreAbility;
|
import com.projectkorra.projectkorra.ability.CoreAbility;
|
||||||
import com.projectkorra.projectkorra.ability.FireAbility;
|
import com.projectkorra.projectkorra.ability.FireAbility;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
|
@ -79,19 +79,37 @@ public class FireBlastCharged extends FireAbility {
|
||||||
this.fireTicks = getConfig().getDouble("Abilities.Fire.FireBlast.Charged.FireTicks");
|
this.fireTicks = getConfig().getDouble("Abilities.Fire.FireBlast.Charged.FireTicks");
|
||||||
this.innerRadius = this.damageRadius / 2;
|
this.innerRadius = this.damageRadius / 2;
|
||||||
|
|
||||||
if (isDay(player.getWorld())) {
|
|
||||||
this.chargeTime = (long) (this.chargeTime / getDayFactor());
|
this.applyModifiers();
|
||||||
this.maxDamage = this.getDayFactor(this.maxDamage);
|
|
||||||
this.range = this.getDayFactor(this.range);
|
if (!player.getEyeLocation().getBlock().isLiquid()) {
|
||||||
|
this.start();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void applyModifiers() {
|
||||||
|
long chargeTimeMod = 0;
|
||||||
|
int damageMod = 0;
|
||||||
|
int rangeMod = 0;
|
||||||
|
|
||||||
|
if (isDay(player.getWorld())) {
|
||||||
|
chargeTimeMod = (long) (this.chargeTime / getDayFactor()) - this.chargeTime;
|
||||||
|
damageMod = (int) (this.getDayFactor(this.maxDamage) - this.maxDamage);
|
||||||
|
rangeMod = (int) (this.getDayFactor(this.range) - this.range);
|
||||||
|
}
|
||||||
|
|
||||||
|
chargeTimeMod = (long) (bPlayer.canUseSubElement(SubElement.BLUE_FIRE) ? (chargeTime / BlueFireAbility.getCooldownFactor() - chargeTime) + chargeTimeMod : chargeTimeMod);
|
||||||
|
damageMod = (int) (bPlayer.canUseSubElement(SubElement.BLUE_FIRE) ? (BlueFireAbility.getDamageFactor() * maxDamage - maxDamage) + damageMod : damageMod);
|
||||||
|
rangeMod = (int) (bPlayer.canUseSubElement(SubElement.BLUE_FIRE) ? (BlueFireAbility.getRangeFactor() * range - range) + rangeMod : rangeMod);
|
||||||
|
|
||||||
if (this.bPlayer.isAvatarState()) {
|
if (this.bPlayer.isAvatarState()) {
|
||||||
this.chargeTime = getConfig().getLong("Abilities.Avatar.AvatarState.Fire.FireBlast.Charged.ChargeTime");
|
this.chargeTime = getConfig().getLong("Abilities.Avatar.AvatarState.Fire.FireBlast.Charged.ChargeTime");
|
||||||
this.maxDamage = getConfig().getDouble("Abilities.Avatar.AvatarState.Fire.FireBlast.Charged.Damage");
|
this.maxDamage = getConfig().getDouble("Abilities.Avatar.AvatarState.Fire.FireBlast.Charged.Damage");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!player.getEyeLocation().getBlock().isLiquid()) {
|
this.chargeTime += chargeTimeMod;
|
||||||
this.start();
|
this.maxDamage += damageMod;
|
||||||
}
|
this.range += rangeMod;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean annihilateBlasts(final Location location, final double radius, final Player source) {
|
public static boolean annihilateBlasts(final Location location, final double radius, final Player source) {
|
||||||
|
@ -207,8 +225,7 @@ public class FireBlastCharged extends FireAbility {
|
||||||
|
|
||||||
private void executeFireball() {
|
private void executeFireball() {
|
||||||
for (final Block block : GeneralMethods.getBlocksAroundPoint(this.location, this.collisionRadius)) {
|
for (final Block block : GeneralMethods.getBlocksAroundPoint(this.location, this.collisionRadius)) {
|
||||||
ParticleEffect.FLAME.display(block.getLocation(), 5, 0.5, 0.5, 0.5, 0);
|
playFirebendingParticles(block.getLocation(), 5, 0.5, 0.5, 0.5);
|
||||||
ParticleEffect.SMOKE_NORMAL.display(block.getLocation(), 2, 0.5, 0.5, 0.5, 0);
|
|
||||||
if ((new Random()).nextInt(4) == 0) {
|
if ((new Random()).nextInt(4) == 0) {
|
||||||
playFirebendingSound(this.location);
|
playFirebendingSound(this.location);
|
||||||
}
|
}
|
||||||
|
@ -233,15 +250,8 @@ public class FireBlastCharged extends FireAbility {
|
||||||
|
|
||||||
private void ignite(final Location location) {
|
private void ignite(final Location location) {
|
||||||
for (final Block block : GeneralMethods.getBlocksAroundPoint(location, this.collisionRadius)) {
|
for (final Block block : GeneralMethods.getBlocksAroundPoint(location, this.collisionRadius)) {
|
||||||
if (BlazeArc.isIgnitable(this.player, block)) {
|
if (isIgnitable(block)) {
|
||||||
if (block.getType() != Material.FIRE) {
|
createTempFire(block.getLocation());
|
||||||
BlazeArc.getReplacedBlocks().put(block.getLocation(), block.getState());
|
|
||||||
}
|
|
||||||
block.setType(Material.FIRE);
|
|
||||||
if (this.dissipate) {
|
|
||||||
BlazeArc.getIgnitedBlocks().put(block, this.player);
|
|
||||||
BlazeArc.getIgnitedTimes().put(block, System.currentTimeMillis());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -282,7 +292,7 @@ public class FireBlastCharged extends FireAbility {
|
||||||
if (!this.launched && !this.charged) {
|
if (!this.launched && !this.charged) {
|
||||||
return;
|
return;
|
||||||
} else if (!this.launched) {
|
} else if (!this.launched) {
|
||||||
this.player.getWorld().playEffect(this.player.getEyeLocation(), Effect.MOBSPAWNER_FLAMES, 0, 3);
|
playFirebendingParticles(this.player.getEyeLocation().clone().add(this.player.getEyeLocation().getDirection().clone()), 3, .001, .001, .001);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.projectkorra.projectkorra.firebending;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.Effect;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -12,6 +11,8 @@ import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
import com.projectkorra.projectkorra.ProjectKorra;
|
import com.projectkorra.projectkorra.ProjectKorra;
|
||||||
|
import com.projectkorra.projectkorra.Element.SubElement;
|
||||||
|
import com.projectkorra.projectkorra.ability.BlueFireAbility;
|
||||||
import com.projectkorra.projectkorra.ability.FireAbility;
|
import com.projectkorra.projectkorra.ability.FireAbility;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
|
|
||||||
|
@ -49,15 +50,22 @@ public class FireBurst extends FireAbility {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long chargeTimeMod = 0;
|
||||||
|
|
||||||
if (isDay(player.getWorld())) {
|
if (isDay(player.getWorld())) {
|
||||||
this.chargeTime /= getDayFactor();
|
chargeTimeMod = (long) (this.getDayFactor(chargeTime) - chargeTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
chargeTimeMod = (long) (bPlayer.canUseSubElement(SubElement.BLUE_FIRE) ? (chargeTime / BlueFireAbility.getCooldownFactor() - chargeTime) + chargeTimeMod : chargeTimeMod);
|
||||||
|
|
||||||
if (this.bPlayer.isAvatarState()) {
|
if (this.bPlayer.isAvatarState()) {
|
||||||
this.chargeTime = getConfig().getLong("Abilities.Avatar.AvatarState.Fire.FireBurst.Damage");
|
this.chargeTime = getConfig().getLong("Abilities.Avatar.AvatarState.Fire.FireBurst.Damage");
|
||||||
this.damage = getConfig().getInt("Abilities.Avatar.AvatarState.Fire.FireBurst.Damage");
|
this.damage = getConfig().getInt("Abilities.Avatar.AvatarState.Fire.FireBurst.Damage");
|
||||||
this.cooldown = getConfig().getLong("Abilities.Avatar.AvatarState.Fire.FireBurst.Cooldown");
|
this.cooldown = getConfig().getLong("Abilities.Avatar.AvatarState.Fire.FireBurst.Cooldown");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.chargeTime += chargeTimeMod;
|
||||||
|
|
||||||
this.start();
|
this.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +146,8 @@ public class FireBurst extends FireAbility {
|
||||||
}
|
}
|
||||||
} else if (this.charged) {
|
} else if (this.charged) {
|
||||||
final Location location = this.player.getEyeLocation();
|
final Location location = this.player.getEyeLocation();
|
||||||
location.getWorld().playEffect(location, Effect.MOBSPAWNER_FLAMES, 4, 3);
|
location.add(location.getDirection());
|
||||||
|
playFirebendingParticles(location, 1, .01, .01, .01);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@ import com.projectkorra.projectkorra.ability.ElementalAbility;
|
||||||
import com.projectkorra.projectkorra.ability.FireAbility;
|
import com.projectkorra.projectkorra.ability.FireAbility;
|
||||||
import com.projectkorra.projectkorra.airbending.AirSpout;
|
import com.projectkorra.projectkorra.airbending.AirSpout;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
import com.projectkorra.projectkorra.util.ParticleEffect;
|
|
||||||
|
|
||||||
public class FireJet extends FireAbility {
|
public class FireJet extends FireAbility {
|
||||||
|
|
||||||
|
@ -57,7 +56,7 @@ public class FireJet extends FireAbility {
|
||||||
this.speed = this.getDayFactor(this.speed);
|
this.speed = this.getDayFactor(this.speed);
|
||||||
final Block block = player.getLocation().getBlock();
|
final Block block = player.getLocation().getBlock();
|
||||||
|
|
||||||
if (BlazeArc.isIgnitable(player, block) || ElementalAbility.isAir(block.getType()) || block.getType() == Material.STONE_SLAB || block.getType() == Material.ACACIA_SLAB || block.getType() == Material.BIRCH_SLAB || block.getType() == Material.DARK_OAK_SLAB || block.getType() == Material.JUNGLE_SLAB || block.getType() == Material.OAK_SLAB || block.getType() == Material.SPRUCE_SLAB || isIlluminationTorch(block) || this.bPlayer.isAvatarState()) {
|
if (isIgnitable(block) || ElementalAbility.isAir(block.getType()) || block.getType() == Material.STONE_SLAB || block.getType() == Material.ACACIA_SLAB || block.getType() == Material.BIRCH_SLAB || block.getType() == Material.DARK_OAK_SLAB || block.getType() == Material.JUNGLE_SLAB || block.getType() == Material.OAK_SLAB || block.getType() == Material.SPRUCE_SLAB || isIlluminationTorch(block) || this.bPlayer.isAvatarState()) {
|
||||||
player.setVelocity(player.getEyeLocation().getDirection().clone().normalize().multiply(this.speed));
|
player.setVelocity(player.getEyeLocation().getDirection().clone().normalize().multiply(this.speed));
|
||||||
if (!canFireGrief()) {
|
if (!canFireGrief()) {
|
||||||
if (ElementalAbility.isAir(block.getType())) {
|
if (ElementalAbility.isAir(block.getType())) {
|
||||||
|
@ -65,7 +64,7 @@ public class FireJet extends FireAbility {
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (ElementalAbility.isAir(block.getType())) {
|
} else if (ElementalAbility.isAir(block.getType())) {
|
||||||
block.setType(Material.FIRE);
|
createTempFire(block.getLocation());
|
||||||
}
|
}
|
||||||
|
|
||||||
this.flightHandler.createInstance(player, this.getName());
|
this.flightHandler.createInstance(player, this.getName());
|
||||||
|
@ -93,8 +92,7 @@ public class FireJet extends FireAbility {
|
||||||
playFirebendingSound(this.player.getLocation());
|
playFirebendingSound(this.player.getLocation());
|
||||||
}
|
}
|
||||||
|
|
||||||
ParticleEffect.FLAME.display(this.player.getLocation(), 20, 0.6, 0.6, 0.6);
|
playFirebendingParticles(this.player.getLocation(), 10, 0.3, 0.3, 0.3);
|
||||||
ParticleEffect.SMOKE_NORMAL.display(this.player.getLocation(), 10, 0.6, 0.6, 0.6);
|
|
||||||
double timefactor;
|
double timefactor;
|
||||||
|
|
||||||
if (this.bPlayer.isAvatarState() && this.avatarStateToggled) {
|
if (this.bPlayer.isAvatarState() && this.avatarStateToggled) {
|
||||||
|
|
|
@ -15,7 +15,6 @@ import org.bukkit.util.Vector;
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
import com.projectkorra.projectkorra.ability.FireAbility;
|
import com.projectkorra.projectkorra.ability.FireAbility;
|
||||||
import com.projectkorra.projectkorra.util.DamageHandler;
|
import com.projectkorra.projectkorra.util.DamageHandler;
|
||||||
import com.projectkorra.projectkorra.util.ParticleEffect;
|
|
||||||
|
|
||||||
public class FireManipulation extends FireAbility {
|
public class FireManipulation extends FireAbility {
|
||||||
|
|
||||||
|
@ -113,8 +112,7 @@ public class FireManipulation extends FireAbility {
|
||||||
this.points.remove(point);
|
this.points.remove(point);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ParticleEffect.FLAME.display(point, 12, 0.25, 0.25, 0.25);
|
playFirebendingParticles(point, 12, 0.25, 0.25, 0.25);
|
||||||
ParticleEffect.SMOKE_NORMAL.display(point, 6, 0.25, 0.25, 0.25);
|
|
||||||
for (final Entity entity : GeneralMethods.getEntitiesAroundPoint(point, 1.2D)) {
|
for (final Entity entity : GeneralMethods.getEntitiesAroundPoint(point, 1.2D)) {
|
||||||
if (entity instanceof LivingEntity && entity.getUniqueId() != this.player.getUniqueId()) {
|
if (entity instanceof LivingEntity && entity.getUniqueId() != this.player.getUniqueId()) {
|
||||||
DamageHandler.damageEntity(entity, this.shieldDamage, this);
|
DamageHandler.damageEntity(entity, this.shieldDamage, this);
|
||||||
|
@ -143,8 +141,7 @@ public class FireManipulation extends FireAbility {
|
||||||
for (final Location point : this.points.keySet()) {
|
for (final Location point : this.points.keySet()) {
|
||||||
final Vector direction = this.focalPoint.toVector().subtract(point.toVector());
|
final Vector direction = this.focalPoint.toVector().subtract(point.toVector());
|
||||||
point.add(direction.clone().multiply(this.streamSpeed / 5));
|
point.add(direction.clone().multiply(this.streamSpeed / 5));
|
||||||
ParticleEffect.FLAME.display(point, this.shieldParticles, 0.25, 0.25, 0.25);
|
playFirebendingParticles(point, this.shieldParticles, 0.25, 0.25, 0.25);
|
||||||
ParticleEffect.SMOKE_NORMAL.display(point, this.shieldParticles / 2, 0.25, 0.25, 0.25);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Vector direction = this.player.getLocation().getDirection().clone();
|
Vector direction = this.player.getLocation().getDirection().clone();
|
||||||
|
@ -173,8 +170,7 @@ public class FireManipulation extends FireAbility {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ParticleEffect.FLAME.display(this.shotPoint, this.streamParticles, 0.5, 0.5, 0.5, 0.01);
|
playFirebendingParticles(this.shotPoint, this.streamParticles, 0.5, 0.5, 0.5);
|
||||||
ParticleEffect.SMOKE_NORMAL.display(this.shotPoint, this.streamParticles / 2, 0.5, 0.5, 0.5, 0.01);
|
|
||||||
for (final Entity entity : GeneralMethods.getEntitiesAroundPoint(this.shotPoint, 2)) {
|
for (final Entity entity : GeneralMethods.getEntitiesAroundPoint(this.shotPoint, 2)) {
|
||||||
if (entity instanceof LivingEntity && entity.getUniqueId() != this.player.getUniqueId()) {
|
if (entity instanceof LivingEntity && entity.getUniqueId() != this.player.getUniqueId()) {
|
||||||
DamageHandler.damageEntity(entity, this.streamDamage, this);
|
DamageHandler.damageEntity(entity, this.streamDamage, this);
|
||||||
|
|
|
@ -2,10 +2,7 @@ package com.projectkorra.projectkorra.firebending;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import org.bukkit.Effect;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -17,7 +14,6 @@ import com.projectkorra.projectkorra.ability.FireAbility;
|
||||||
import com.projectkorra.projectkorra.ability.util.Collision;
|
import com.projectkorra.projectkorra.ability.util.Collision;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
import com.projectkorra.projectkorra.firebending.util.FireDamageTimer;
|
import com.projectkorra.projectkorra.firebending.util.FireDamageTimer;
|
||||||
import com.projectkorra.projectkorra.util.ParticleEffect;
|
|
||||||
|
|
||||||
public class FireShield extends FireAbility {
|
public class FireShield extends FireAbility {
|
||||||
|
|
||||||
|
@ -125,11 +121,8 @@ public class FireShield extends FireAbility {
|
||||||
final double rtheta = Math.toRadians(theta);
|
final double rtheta = Math.toRadians(theta);
|
||||||
|
|
||||||
final Location display = this.location.clone().add(this.shieldRadius / 1.5 * Math.cos(rphi) * Math.sin(rtheta), this.shieldRadius / 1.5 * Math.cos(rtheta), this.shieldRadius / 1.5 * Math.sin(rphi) * Math.sin(rtheta));
|
final Location display = this.location.clone().add(this.shieldRadius / 1.5 * Math.cos(rphi) * Math.sin(rtheta), this.shieldRadius / 1.5 * Math.cos(rtheta), this.shieldRadius / 1.5 * Math.sin(rphi) * Math.sin(rtheta));
|
||||||
if (this.random.nextInt(6) == 0) {
|
|
||||||
ParticleEffect.SMOKE_NORMAL.display(display, 1, 0, 0, 0);
|
|
||||||
}
|
|
||||||
if (this.random.nextInt(4) == 0) {
|
if (this.random.nextInt(4) == 0) {
|
||||||
ParticleEffect.FLAME.display(display, 1, 0.1, 0.1, 0.1, 0.013);
|
playFirebendingParticles(display, 1, 0.1, 0.1, 0.1);
|
||||||
}
|
}
|
||||||
if (this.random.nextInt(7) == 0) {
|
if (this.random.nextInt(7) == 0) {
|
||||||
playFirebendingSound(display);
|
playFirebendingSound(display);
|
||||||
|
@ -142,13 +135,6 @@ public class FireShield extends FireAbility {
|
||||||
this.increment = 20;
|
this.increment = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (final Block testblock : GeneralMethods.getBlocksAroundPoint(this.player.getLocation(), this.shieldRadius)) {
|
|
||||||
if (testblock.getType() == Material.FIRE) {
|
|
||||||
testblock.setType(Material.AIR);
|
|
||||||
testblock.getWorld().playEffect(testblock.getLocation(), Effect.EXTINGUISH, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (final Entity entity : GeneralMethods.getEntitiesAroundPoint(this.location, this.shieldRadius)) {
|
for (final Entity entity : GeneralMethods.getEntitiesAroundPoint(this.location, this.shieldRadius)) {
|
||||||
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation())) {
|
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation())) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -165,15 +151,12 @@ public class FireShield extends FireAbility {
|
||||||
this.location = this.player.getEyeLocation().clone();
|
this.location = this.player.getEyeLocation().clone();
|
||||||
final Vector direction = this.location.getDirection();
|
final Vector direction = this.location.getDirection();
|
||||||
this.location.add(direction.multiply(this.shieldRadius));
|
this.location.add(direction.multiply(this.shieldRadius));
|
||||||
ParticleEffect.FLAME.display(this.location, 3, 0.2, 0.2, 0.2, 0.00023);
|
playFirebendingParticles(this.location, 3, 0.2, 0.2, 0.2);
|
||||||
|
|
||||||
for (double theta = 0; theta < 360; theta += 20) {
|
for (double theta = 0; theta < 360; theta += 20) {
|
||||||
final Vector vector = GeneralMethods.getOrthogonalVector(direction, theta, this.discRadius / 1.5);
|
final Vector vector = GeneralMethods.getOrthogonalVector(direction, theta, this.discRadius / 1.5);
|
||||||
final Location display = this.location.add(vector);
|
final Location display = this.location.add(vector);
|
||||||
if (this.random.nextInt(6) == 0) {
|
playFirebendingParticles(display, 2, 0.3, 0.2, 0.3);
|
||||||
ParticleEffect.SMOKE_NORMAL.display(display, 1, 0, 0, 0);
|
|
||||||
}
|
|
||||||
ParticleEffect.FLAME.display(display, 2, 0.3, 0.2, 0.3, 0.023);
|
|
||||||
if (this.random.nextInt(4) == 0) {
|
if (this.random.nextInt(4) == 0) {
|
||||||
playFirebendingSound(display);
|
playFirebendingSound(display);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.BendingPlayer;
|
import com.projectkorra.projectkorra.BendingPlayer;
|
||||||
|
import com.projectkorra.projectkorra.Element.SubElement;
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
import com.projectkorra.projectkorra.ProjectKorra;
|
import com.projectkorra.projectkorra.ProjectKorra;
|
||||||
import com.projectkorra.projectkorra.ability.FireAbility;
|
import com.projectkorra.projectkorra.ability.FireAbility;
|
||||||
|
@ -43,7 +44,7 @@ public class HeatControl extends FireAbility {
|
||||||
COOK, EXTINGUISH, MELT, SOLIDIFY
|
COOK, EXTINGUISH, MELT, SOLIDIFY
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Material[] COOKABLE_MATERIALS = { Material.BEEF, Material.CHICKEN, Material.COD, Material.PORKCHOP, Material.POTATO, Material.RABBIT, Material.MUTTON, Material.SALMON, Material.KELP };
|
private static final Material[] COOKABLE_MATERIALS = { Material.BEEF, Material.CHICKEN, Material.COD, Material.PORKCHOP, Material.POTATO, Material.RABBIT, Material.MUTTON, Material.SALMON, Material.KELP, Material.WET_SPONGE, Material.CHORUS_FRUIT, Material.STICK };
|
||||||
|
|
||||||
private HeatControlType heatControlType;
|
private HeatControlType heatControlType;
|
||||||
|
|
||||||
|
@ -194,7 +195,7 @@ public class HeatControl extends FireAbility {
|
||||||
|
|
||||||
for (final Block block : GeneralMethods.getBlocksAroundPoint(this.player.getLocation(), this.extinguishRadius)) {
|
for (final Block block : GeneralMethods.getBlocksAroundPoint(this.player.getLocation(), this.extinguishRadius)) {
|
||||||
final Material material = block.getType();
|
final Material material = block.getType();
|
||||||
if (material == Material.FIRE && !GeneralMethods.isRegionProtectedFromBuild(this, block.getLocation())) {
|
if (isFire(material) && !GeneralMethods.isRegionProtectedFromBuild(this, block.getLocation())) {
|
||||||
|
|
||||||
block.setType(Material.AIR);
|
block.setType(Material.AIR);
|
||||||
block.getWorld().playEffect(block.getLocation(), Effect.EXTINGUISH, 0);
|
block.getWorld().playEffect(block.getLocation(), Effect.EXTINGUISH, 0);
|
||||||
|
@ -273,6 +274,14 @@ public class HeatControl extends FireAbility {
|
||||||
case KELP:
|
case KELP:
|
||||||
cooked = new ItemStack(Material.DRIED_KELP);
|
cooked = new ItemStack(Material.DRIED_KELP);
|
||||||
break;
|
break;
|
||||||
|
case CHORUS_FRUIT:
|
||||||
|
cooked = new ItemStack(Material.POPPED_CHORUS_FRUIT);
|
||||||
|
break;
|
||||||
|
case WET_SPONGE:
|
||||||
|
cooked = new ItemStack(Material.SPONGE);
|
||||||
|
break;
|
||||||
|
case STICK:
|
||||||
|
cooked = bPlayer.canUseSubElement(SubElement.BLUE_FIRE) ? new ItemStack(Material.SOUL_TORCH) : new ItemStack(Material.TORCH);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -281,7 +290,7 @@ public class HeatControl extends FireAbility {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void displayCookParticles() {
|
public void displayCookParticles() {
|
||||||
ParticleEffect.FLAME.display(this.player.getLocation().clone().add(0, 1, 0), 3, 0.5, 0.5, 0.5);
|
playFirebendingParticles(this.player.getLocation().clone().add(0, 1, 0), 3, 0.5, 0.5, 0.5);
|
||||||
ParticleEffect.SMOKE_NORMAL.display(this.player.getLocation().clone().add(0, 1, 0), 2, 0.5, 0.5, 0.5);
|
ParticleEffect.SMOKE_NORMAL.display(this.player.getLocation().clone().add(0, 1, 0), 2, 0.5, 0.5, 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.Element;
|
import com.projectkorra.projectkorra.Element;
|
||||||
|
import com.projectkorra.projectkorra.Element.SubElement;
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
import com.projectkorra.projectkorra.ability.FireAbility;
|
import com.projectkorra.projectkorra.ability.FireAbility;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
|
@ -112,9 +113,7 @@ public class Illumination extends FireAbility {
|
||||||
final Block standingBlock = this.player.getLocation().getBlock();
|
final Block standingBlock = this.player.getLocation().getBlock();
|
||||||
final Block standBlock = standingBlock.getRelative(BlockFace.DOWN);
|
final Block standBlock = standingBlock.getRelative(BlockFace.DOWN);
|
||||||
|
|
||||||
if (!BlazeArc.isIgnitable(this.player, standingBlock)) {
|
if (!GeneralMethods.isSolid(standBlock)) {
|
||||||
return;
|
|
||||||
} else if (!GeneralMethods.isSolid(standBlock)) {
|
|
||||||
return;
|
return;
|
||||||
} else if (this.block != null && standingBlock.equals(this.block.getBlock())) {
|
} else if (this.block != null && standingBlock.equals(this.block.getBlock())) {
|
||||||
return;
|
return;
|
||||||
|
@ -125,7 +124,7 @@ public class Illumination extends FireAbility {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.revert();
|
this.revert();
|
||||||
this.block = new TempBlock(standingBlock, Material.TORCH);
|
this.block = bPlayer.canUseSubElement(SubElement.BLUE_FIRE) ? new TempBlock(standingBlock, Material.SOUL_TORCH) : new TempBlock(standingBlock, Material.TORCH);
|
||||||
BLOCKS.put(this.block, this.player);
|
BLOCKS.put(this.block, this.player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,13 +11,14 @@ import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import com.projectkorra.projectkorra.Element.SubElement;
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
import com.projectkorra.projectkorra.ability.AirAbility;
|
import com.projectkorra.projectkorra.ability.AirAbility;
|
||||||
|
import com.projectkorra.projectkorra.ability.BlueFireAbility;
|
||||||
import com.projectkorra.projectkorra.ability.FireAbility;
|
import com.projectkorra.projectkorra.ability.FireAbility;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
import com.projectkorra.projectkorra.firebending.util.FireDamageTimer;
|
import com.projectkorra.projectkorra.firebending.util.FireDamageTimer;
|
||||||
import com.projectkorra.projectkorra.util.DamageHandler;
|
import com.projectkorra.projectkorra.util.DamageHandler;
|
||||||
import com.projectkorra.projectkorra.util.ParticleEffect;
|
|
||||||
import com.projectkorra.projectkorra.util.TempBlock;
|
import com.projectkorra.projectkorra.util.TempBlock;
|
||||||
|
|
||||||
public class WallOfFire extends FireAbility {
|
public class WallOfFire extends FireAbility {
|
||||||
|
@ -72,13 +73,23 @@ public class WallOfFire extends FireAbility {
|
||||||
|
|
||||||
this.origin = GeneralMethods.getTargetedLocation(player, this.range);
|
this.origin = GeneralMethods.getTargetedLocation(player, this.range);
|
||||||
|
|
||||||
|
int widthMod = 0;
|
||||||
|
int heightMod = 0;
|
||||||
|
long durationMod = 0;
|
||||||
|
int damageMod = 0;
|
||||||
|
|
||||||
if (isDay(player.getWorld())) {
|
if (isDay(player.getWorld())) {
|
||||||
this.width = (int) this.getDayFactor(this.width);
|
widthMod = (int) this.getDayFactor(this.width) - this.width;
|
||||||
this.height = (int) this.getDayFactor(this.height);
|
heightMod = (int) this.getDayFactor(this.height) - this.height;
|
||||||
this.duration = (long) this.getDayFactor(this.duration);
|
durationMod = ((long) this.getDayFactor(this.duration) - this.duration);
|
||||||
this.damage = (int) this.getDayFactor(this.damage);
|
damageMod = (int) (this.getDayFactor(this.damage) - this.damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
widthMod = (int) (bPlayer.canUseSubElement(SubElement.BLUE_FIRE) ? (BlueFireAbility.getRangeFactor() * width - width) + widthMod : widthMod);
|
||||||
|
heightMod = (int) (bPlayer.canUseSubElement(SubElement.BLUE_FIRE) ? (BlueFireAbility.getRangeFactor() * height - height) + heightMod : heightMod);
|
||||||
|
durationMod = (int) (bPlayer.canUseSubElement(SubElement.BLUE_FIRE) ? (duration / BlueFireAbility.getCooldownFactor() - duration) + durationMod : durationMod);
|
||||||
|
damageMod = (int) (bPlayer.canUseSubElement(SubElement.BLUE_FIRE) ? (BlueFireAbility.getDamageFactor() * damage - damage) + damageMod : damageMod);
|
||||||
|
|
||||||
if (this.bPlayer.isAvatarState()) {
|
if (this.bPlayer.isAvatarState()) {
|
||||||
this.width = getConfig().getInt("Abilities.Avatar.AvatarState.Fire.WallOfFire.Width");
|
this.width = getConfig().getInt("Abilities.Avatar.AvatarState.Fire.WallOfFire.Width");
|
||||||
this.height = getConfig().getInt("Abilities.Avatar.AvatarState.Fire.WallOfFire.Height");
|
this.height = getConfig().getInt("Abilities.Avatar.AvatarState.Fire.WallOfFire.Height");
|
||||||
|
@ -87,6 +98,11 @@ public class WallOfFire extends FireAbility {
|
||||||
this.fireTicks = getConfig().getDouble("Abilities.Avatar.AvatarState.Fire.WallOfFire.FireTicks");
|
this.fireTicks = getConfig().getDouble("Abilities.Avatar.AvatarState.Fire.WallOfFire.FireTicks");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.width += widthMod;
|
||||||
|
this.height += heightMod;
|
||||||
|
this.duration += durationMod;
|
||||||
|
this.damage += damageMod;
|
||||||
|
|
||||||
this.time = System.currentTimeMillis();
|
this.time = System.currentTimeMillis();
|
||||||
final Block block = this.origin.getBlock();
|
final Block block = this.origin.getBlock();
|
||||||
if (block.isLiquid() || GeneralMethods.isSolid(block)) {
|
if (block.isLiquid() || GeneralMethods.isSolid(block)) {
|
||||||
|
@ -147,9 +163,7 @@ public class WallOfFire extends FireAbility {
|
||||||
if (!this.isTransparent(block)) {
|
if (!this.isTransparent(block)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ParticleEffect.FLAME.display(block.getLocation(), 3, 0.6, 0.6, 0.6);
|
playFirebendingParticles(block.getLocation(), 3, 0.6, 0.6, 0.6);
|
||||||
ParticleEffect.SMOKE_NORMAL.display(block.getLocation(), 2, 0.6, 0.6, 0.6);
|
|
||||||
|
|
||||||
if (this.random.nextInt(7) == 0) {
|
if (this.random.nextInt(7) == 0) {
|
||||||
playFirebendingSound(block.getLocation());
|
playFirebendingSound(block.getLocation());
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.BendingPlayer;
|
import com.projectkorra.projectkorra.BendingPlayer;
|
||||||
|
import com.projectkorra.projectkorra.Element.SubElement;
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
import com.projectkorra.projectkorra.ability.CoreAbility;
|
import com.projectkorra.projectkorra.ability.CoreAbility;
|
||||||
import com.projectkorra.projectkorra.ability.ElementalAbility;
|
import com.projectkorra.projectkorra.ability.ElementalAbility;
|
||||||
|
@ -61,9 +62,9 @@ public class FireComboStream extends BukkitRunnable {
|
||||||
this.checkCollisionCounter = 0;
|
this.checkCollisionCounter = 0;
|
||||||
this.spread = 0;
|
this.spread = 0;
|
||||||
this.collisionRadius = 2;
|
this.collisionRadius = 2;
|
||||||
this.particleEffect = ParticleEffect.FLAME;
|
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.bPlayer = BendingPlayer.getBendingPlayer(player);
|
this.bPlayer = BendingPlayer.getBendingPlayer(player);
|
||||||
|
this.particleEffect = bPlayer.canUseSubElement(SubElement.BLUE_FIRE) ? ParticleEffect.SOUL_FIRE_FLAME : ParticleEffect.FLAME;
|
||||||
this.coreAbility = coreAbility;
|
this.coreAbility = coreAbility;
|
||||||
this.direction = direction;
|
this.direction = direction;
|
||||||
this.speed = speed;
|
this.speed = speed;
|
||||||
|
|
|
@ -21,7 +21,6 @@ import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
import com.projectkorra.projectkorra.firebending.util.FireDamageTimer;
|
import com.projectkorra.projectkorra.firebending.util.FireDamageTimer;
|
||||||
import com.projectkorra.projectkorra.util.ClickType;
|
import com.projectkorra.projectkorra.util.ClickType;
|
||||||
import com.projectkorra.projectkorra.util.DamageHandler;
|
import com.projectkorra.projectkorra.util.DamageHandler;
|
||||||
import com.projectkorra.projectkorra.util.ParticleEffect;
|
|
||||||
|
|
||||||
public class FireWheel extends FireAbility implements ComboAbility {
|
public class FireWheel extends FireAbility implements ComboAbility {
|
||||||
|
|
||||||
|
@ -139,7 +138,7 @@ public class FireWheel extends FireAbility implements ComboAbility {
|
||||||
final Vector newDir = this.direction.clone().multiply(this.radius * Math.cos(Math.toRadians(i)));
|
final Vector newDir = this.direction.clone().multiply(this.radius * Math.cos(Math.toRadians(i)));
|
||||||
tempLoc.add(newDir);
|
tempLoc.add(newDir);
|
||||||
tempLoc.setY(tempLoc.getY() + (this.radius * Math.sin(Math.toRadians(i))));
|
tempLoc.setY(tempLoc.getY() + (this.radius * Math.sin(Math.toRadians(i))));
|
||||||
ParticleEffect.FLAME.display(tempLoc, 0, 0, 0, 0, 1);
|
playFirebendingParticles(tempLoc, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (final Entity entity : GeneralMethods.getEntitiesAroundPoint(this.location, this.radius + 0.5)) {
|
for (final Entity entity : GeneralMethods.getEntitiesAroundPoint(this.location, this.radius + 0.5)) {
|
||||||
|
|
|
@ -41,6 +41,8 @@ public class Combustion extends CombustionAbility {
|
||||||
private Location origin;
|
private Location origin;
|
||||||
private Vector direction;
|
private Vector direction;
|
||||||
|
|
||||||
|
private int explosionCount;
|
||||||
|
|
||||||
public Combustion(final Player player) {
|
public Combustion(final Player player) {
|
||||||
super(player);
|
super(player);
|
||||||
|
|
||||||
|
@ -59,6 +61,7 @@ public class Combustion extends CombustionAbility {
|
||||||
this.origin = player.getEyeLocation();
|
this.origin = player.getEyeLocation();
|
||||||
this.direction = player.getEyeLocation().getDirection().normalize();
|
this.direction = player.getEyeLocation().getDirection().normalize();
|
||||||
this.location = this.origin.clone();
|
this.location = this.origin.clone();
|
||||||
|
this.explosionCount = 0;
|
||||||
|
|
||||||
if (this.bPlayer.isAvatarState()) {
|
if (this.bPlayer.isAvatarState()) {
|
||||||
this.range = AvatarState.getValue(this.range);
|
this.range = AvatarState.getValue(this.range);
|
||||||
|
@ -103,13 +106,17 @@ public class Combustion extends CombustionAbility {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void advanceLocation() {
|
private void advanceLocation() {
|
||||||
ParticleEffect.FIREWORKS_SPARK.display(this.location, 5, Math.random() / 2, Math.random() / 2, Math.random() / 2, 0);
|
ParticleEffect.FIREWORKS_SPARK.display(this.location, 2, .001, .001, .001, 0);
|
||||||
ParticleEffect.FLAME.display(this.location, 2, Math.random() / 2, Math.random() / 2, Math.random() / 2);
|
if(explosionCount % 5 == 0)
|
||||||
|
ParticleEffect.EXPLOSION_LARGE.display(this.location, 1, .001, .001, .001, 0);
|
||||||
playCombustionSound(this.location);
|
playCombustionSound(this.location);
|
||||||
this.location = this.location.add(this.direction.clone().multiply(this.speedFactor));
|
this.location = this.location.add(this.direction.clone().multiply(this.speedFactor));
|
||||||
|
this.explosionCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createExplosion(final Location block, final float power, final boolean canBreakBlocks) {
|
private void createExplosion(final Location block, final float power, final boolean canBreakBlocks) {
|
||||||
|
ParticleEffect.EXPLOSION_LARGE.display(block, 3, 2, 2, 2, 0);
|
||||||
|
|
||||||
if (canFireGrief()) {
|
if (canFireGrief()) {
|
||||||
block.getWorld().createExplosion(block.getX(), block.getY(), block.getZ(), power, true, canBreakBlocks);
|
block.getWorld().createExplosion(block.getX(), block.getY(), block.getZ(), power, true, canBreakBlocks);
|
||||||
}
|
}
|
||||||
|
@ -121,6 +128,7 @@ public class Combustion extends CombustionAbility {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.remove();
|
this.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package com.projectkorra.projectkorra.firebending.util;
|
package com.projectkorra.projectkorra.firebending.util;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.ProjectKorra;
|
import com.projectkorra.projectkorra.ProjectKorra;
|
||||||
import com.projectkorra.projectkorra.ability.FireAbility;
|
|
||||||
import com.projectkorra.projectkorra.firebending.BlazeArc;
|
|
||||||
|
|
||||||
public class FirebendingManager implements Runnable {
|
public class FirebendingManager implements Runnable {
|
||||||
|
|
||||||
|
@ -14,9 +12,6 @@ public class FirebendingManager implements Runnable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
BlazeArc.handleDissipation();
|
|
||||||
FireDamageTimer.handleFlames();
|
FireDamageTimer.handleFlames();
|
||||||
BlazeArc.dissipateAll();
|
|
||||||
FireAbility.removeFire();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,70 +1,15 @@
|
||||||
package com.projectkorra.projectkorra.util;
|
package com.projectkorra.projectkorra.util;
|
||||||
|
|
||||||
import java.lang.reflect.Constructor;
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.util.ReflectionHandler.PackageType;
|
import net.md_5.bungee.api.ChatMessageType;
|
||||||
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
|
|
||||||
public class ActionBar {
|
public class ActionBar {
|
||||||
|
|
||||||
private static boolean initialised = false;
|
public static void sendActionBar(final String message, final Player... player) {
|
||||||
private static Constructor<?> chatSer;
|
for (Player e : player) {
|
||||||
private static Constructor<?> packetChat;
|
e.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(message));
|
||||||
public static Method getHandle;
|
|
||||||
private static Field playerConnection;
|
|
||||||
private static Method sendPacket;
|
|
||||||
private static int version;
|
|
||||||
|
|
||||||
static {
|
|
||||||
try {
|
|
||||||
version = Integer.parseInt(PackageType.getServerVersion().split("_")[1]);
|
|
||||||
chatSer = ReflectionHandler.getConstructor(PackageType.MINECRAFT_SERVER.getClass("ChatComponentText"), String.class);
|
|
||||||
if (version >= 12) {
|
|
||||||
packetChat = PackageType.MINECRAFT_SERVER.getClass("PacketPlayOutChat").getConstructor(PackageType.MINECRAFT_SERVER.getClass("IChatBaseComponent"), PackageType.MINECRAFT_SERVER.getClass("ChatMessageType"));
|
|
||||||
} else {
|
|
||||||
packetChat = PackageType.MINECRAFT_SERVER.getClass("PacketPlayOutChat").getConstructor(PackageType.MINECRAFT_SERVER.getClass("IChatBaseComponent"), byte.class);
|
|
||||||
}
|
|
||||||
getHandle = ReflectionHandler.getMethod("CraftPlayer", PackageType.CRAFTBUKKIT_ENTITY, "getHandle");
|
|
||||||
playerConnection = ReflectionHandler.getField("EntityPlayer", PackageType.MINECRAFT_SERVER, false, "playerConnection");
|
|
||||||
sendPacket = ReflectionHandler.getMethod(playerConnection.getType(), "sendPacket", PackageType.MINECRAFT_SERVER.getClass("Packet"));
|
|
||||||
initialised = true;
|
|
||||||
} catch (final ReflectiveOperationException e) {
|
|
||||||
initialised = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isInitialised() {
|
|
||||||
return initialised;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean sendActionBar(final String message, final Player... player) {
|
|
||||||
if (!initialised) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
final Object o = chatSer.newInstance(message);
|
|
||||||
Object packet;
|
|
||||||
if (version >= 12) {
|
|
||||||
packet = packetChat.newInstance(o, PackageType.MINECRAFT_SERVER.getClass("ChatMessageType").getEnumConstants()[2]);
|
|
||||||
} else {
|
|
||||||
packet = packetChat.newInstance(o, (byte) 2);
|
|
||||||
}
|
|
||||||
sendTo(packet, player);
|
|
||||||
} catch (final ReflectiveOperationException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
initialised = false;
|
|
||||||
}
|
|
||||||
return initialised;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void sendTo(final Object packet, final Player... player) throws ReflectiveOperationException {
|
|
||||||
for (final Player p : player) {
|
|
||||||
final Object entityplayer = getHandle.invoke(p);
|
|
||||||
final Object PlayerConnection = playerConnection.get(entityplayer);
|
|
||||||
sendPacket.invoke(PlayerConnection, packet);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,9 @@ import org.bukkit.Particle.DustOptions;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public enum ParticleEffect {
|
public enum ParticleEffect {
|
||||||
|
|
||||||
|
ASH (Particle.ASH),
|
||||||
|
|
||||||
BARRIER (Particle.BARRIER),
|
BARRIER (Particle.BARRIER),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,7 +22,11 @@ public enum ParticleEffect {
|
||||||
BLOCK_DUST (Particle.BLOCK_DUST),
|
BLOCK_DUST (Particle.BLOCK_DUST),
|
||||||
BUBBLE_COLUMN_UP (Particle.BUBBLE_COLUMN_UP),
|
BUBBLE_COLUMN_UP (Particle.BUBBLE_COLUMN_UP),
|
||||||
BUBBLE_POP (Particle.BUBBLE_POP),
|
BUBBLE_POP (Particle.BUBBLE_POP),
|
||||||
|
CAMPFIRE_COSY_SMOKE (Particle.CAMPFIRE_COSY_SMOKE),
|
||||||
|
CAMPFIRE_SIGNAL_SMOKE (Particle.CAMPFIRE_SIGNAL_SMOKE),
|
||||||
CLOUD (Particle.CLOUD),
|
CLOUD (Particle.CLOUD),
|
||||||
|
COMPOSTER (Particle.COMPOSTER),
|
||||||
|
CRIMSON_SPORE (Particle.CRIMSON_SPORE),
|
||||||
CRIT (Particle.CRIT),
|
CRIT (Particle.CRIT),
|
||||||
CRIT_MAGIC (Particle.CRIT_MAGIC), @Deprecated MAGIC_CRIT (Particle.CRIT_MAGIC),
|
CRIT_MAGIC (Particle.CRIT_MAGIC), @Deprecated MAGIC_CRIT (Particle.CRIT_MAGIC),
|
||||||
CURRENT_DOWN (Particle.CURRENT_DOWN),
|
CURRENT_DOWN (Particle.CURRENT_DOWN),
|
||||||
|
@ -28,6 +35,8 @@ public enum ParticleEffect {
|
||||||
DRAGON_BREATH (Particle.DRAGON_BREATH),
|
DRAGON_BREATH (Particle.DRAGON_BREATH),
|
||||||
DRIP_LAVA (Particle.DRIP_LAVA),
|
DRIP_LAVA (Particle.DRIP_LAVA),
|
||||||
DRIP_WATER (Particle.DRIP_WATER),
|
DRIP_WATER (Particle.DRIP_WATER),
|
||||||
|
DRIPPING_HONEY (Particle.DRIPPING_HONEY),
|
||||||
|
DRIPPING_OBSIDIAN_TEAR (Particle.DRIPPING_OBSIDIAN_TEAR),
|
||||||
ENCHANTMENT_TABLE (Particle.ENCHANTMENT_TABLE),
|
ENCHANTMENT_TABLE (Particle.ENCHANTMENT_TABLE),
|
||||||
END_ROD (Particle.END_ROD),
|
END_ROD (Particle.END_ROD),
|
||||||
EXPLOSION_HUGE (Particle.EXPLOSION_HUGE), @Deprecated HUGE_EXPLOSION (Particle.EXPLOSION_HUGE),
|
EXPLOSION_HUGE (Particle.EXPLOSION_HUGE), @Deprecated HUGE_EXPLOSION (Particle.EXPLOSION_HUGE),
|
||||||
|
@ -38,14 +47,23 @@ public enum ParticleEffect {
|
||||||
* Applicable data: {@link BlockData}
|
* Applicable data: {@link BlockData}
|
||||||
*/
|
*/
|
||||||
FALLING_DUST (Particle.FALLING_DUST),
|
FALLING_DUST (Particle.FALLING_DUST),
|
||||||
|
FALLING_HONEY (Particle.FALLING_HONEY),
|
||||||
|
FALLING_LAVA (Particle.FALLING_LAVA),
|
||||||
|
FALLING_NECTAR (Particle.FALLING_NECTAR),
|
||||||
|
FALLING_OBSIDIAN_TEAR (Particle.FALLING_OBSIDIAN_TEAR),
|
||||||
|
FALLING_WATER (Particle.FALLING_WATER),
|
||||||
FIREWORKS_SPARK (Particle.FIREWORKS_SPARK),
|
FIREWORKS_SPARK (Particle.FIREWORKS_SPARK),
|
||||||
FLAME (Particle.FLAME),
|
FLAME (Particle.FLAME),
|
||||||
|
FLASH (Particle.FLASH),
|
||||||
HEART (Particle.HEART),
|
HEART (Particle.HEART),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Applicable data: {@link ItemStack}
|
* Applicable data: {@link ItemStack}
|
||||||
*/
|
*/
|
||||||
ITEM_CRACK (Particle.ITEM_CRACK),
|
ITEM_CRACK (Particle.ITEM_CRACK),
|
||||||
|
LANDING_HONEY (Particle.LANDING_HONEY),
|
||||||
|
LANDING_LAVA (Particle.LANDING_LAVA),
|
||||||
|
LANDING_OBSIDIAN_TEAR (Particle.LANDING_OBSIDIAN_TEAR),
|
||||||
LAVA (Particle.LAVA),
|
LAVA (Particle.LAVA),
|
||||||
MOB_APPEARANCE (Particle.MOB_APPEARANCE),
|
MOB_APPEARANCE (Particle.MOB_APPEARANCE),
|
||||||
NAUTILUS (Particle.NAUTILUS),
|
NAUTILUS (Particle.NAUTILUS),
|
||||||
|
@ -56,11 +74,15 @@ public enum ParticleEffect {
|
||||||
* Applicable data: {@link DustOptions}
|
* Applicable data: {@link DustOptions}
|
||||||
*/
|
*/
|
||||||
REDSTONE (Particle.REDSTONE), @Deprecated RED_DUST (Particle.REDSTONE),
|
REDSTONE (Particle.REDSTONE), @Deprecated RED_DUST (Particle.REDSTONE),
|
||||||
|
REVERSE_PORTAL (Particle.REVERSE_PORTAL),
|
||||||
SLIME (Particle.SLIME),
|
SLIME (Particle.SLIME),
|
||||||
SMOKE_NORMAL (Particle.SMOKE_NORMAL), @Deprecated SMOKE (Particle.SMOKE_NORMAL),
|
SMOKE_NORMAL (Particle.SMOKE_NORMAL), @Deprecated SMOKE (Particle.SMOKE_NORMAL),
|
||||||
SMOKE_LARGE (Particle.SMOKE_LARGE), @Deprecated LARGE_SMOKE (Particle.SMOKE_LARGE),
|
SMOKE_LARGE (Particle.SMOKE_LARGE), @Deprecated LARGE_SMOKE (Particle.SMOKE_LARGE),
|
||||||
|
SNEEZE (Particle.SNEEZE),
|
||||||
SNOW_SHOVEL (Particle.SNOW_SHOVEL),
|
SNOW_SHOVEL (Particle.SNOW_SHOVEL),
|
||||||
SNOWBALL (Particle.SNOWBALL), @Deprecated SNOWBALL_PROOF (Particle.SNOWBALL),
|
SNOWBALL (Particle.SNOWBALL), @Deprecated SNOWBALL_PROOF (Particle.SNOWBALL),
|
||||||
|
SOUL (Particle.SOUL),
|
||||||
|
SOUL_FIRE_FLAME (Particle.SOUL_FIRE_FLAME),
|
||||||
SPELL (Particle.SPELL),
|
SPELL (Particle.SPELL),
|
||||||
SPELL_INSTANT (Particle.SPELL_INSTANT), @Deprecated INSTANT_SPELL (Particle.SPELL_INSTANT),
|
SPELL_INSTANT (Particle.SPELL_INSTANT), @Deprecated INSTANT_SPELL (Particle.SPELL_INSTANT),
|
||||||
SPELL_MOB (Particle.SPELL_MOB), @Deprecated MOB_SPELL (Particle.SPELL_MOB),
|
SPELL_MOB (Particle.SPELL_MOB), @Deprecated MOB_SPELL (Particle.SPELL_MOB),
|
||||||
|
@ -75,10 +97,12 @@ public enum ParticleEffect {
|
||||||
TOWN_AURA (Particle.TOWN_AURA),
|
TOWN_AURA (Particle.TOWN_AURA),
|
||||||
VILLAGER_ANGRY (Particle.VILLAGER_ANGRY), @Deprecated ANGRY_VILLAGER (Particle.VILLAGER_ANGRY),
|
VILLAGER_ANGRY (Particle.VILLAGER_ANGRY), @Deprecated ANGRY_VILLAGER (Particle.VILLAGER_ANGRY),
|
||||||
VILLAGER_HAPPY (Particle.VILLAGER_HAPPY), @Deprecated HAPPY_VILLAGER (Particle.VILLAGER_HAPPY),
|
VILLAGER_HAPPY (Particle.VILLAGER_HAPPY), @Deprecated HAPPY_VILLAGER (Particle.VILLAGER_HAPPY),
|
||||||
|
WARPED_SPORE (Particle.WARPED_SPORE),
|
||||||
WATER_BUBBLE (Particle.WATER_BUBBLE), @Deprecated BUBBLE (Particle.WATER_BUBBLE),
|
WATER_BUBBLE (Particle.WATER_BUBBLE), @Deprecated BUBBLE (Particle.WATER_BUBBLE),
|
||||||
WATER_DROP (Particle.WATER_DROP),
|
WATER_DROP (Particle.WATER_DROP),
|
||||||
WATER_SPLASH (Particle.WATER_SPLASH), @Deprecated SPLASH (Particle.WATER_SPLASH),
|
WATER_SPLASH (Particle.WATER_SPLASH), @Deprecated SPLASH (Particle.WATER_SPLASH),
|
||||||
WATER_WAKE (Particle.WATER_WAKE), @Deprecated WAKE (Particle.WATER_WAKE);
|
WATER_WAKE (Particle.WATER_WAKE), @Deprecated WAKE (Particle.WATER_WAKE),
|
||||||
|
WHITE_ASH (Particle.WHITE_ASH);
|
||||||
|
|
||||||
Particle particle;
|
Particle particle;
|
||||||
Class<?> dataClass;
|
Class<?> dataClass;
|
||||||
|
|
|
@ -11,6 +11,7 @@ import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.block.Container;
|
import org.bukkit.block.Container;
|
||||||
|
import org.bukkit.block.data.Bisected;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.block.data.Levelled;
|
import org.bukkit.block.data.Levelled;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
@ -30,29 +31,34 @@ public class TempBlock {
|
||||||
});
|
});
|
||||||
|
|
||||||
private final Block block;
|
private final Block block;
|
||||||
private BlockData newdata;
|
private BlockData newData;
|
||||||
private BlockState state;
|
private BlockState state;
|
||||||
private long revertTime;
|
private long revertTime;
|
||||||
private boolean inRevertQueue;
|
private boolean inRevertQueue;
|
||||||
private RevertTask revertTask = null;
|
private RevertTask revertTask = null;
|
||||||
|
|
||||||
public TempBlock(final Block block, final Material newtype) {
|
public TempBlock(final Block block, final Material newtype) {
|
||||||
this(block, newtype.createBlockData());
|
this(block, newtype.createBlockData(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public TempBlock(final Block block, final Material newtype, final BlockData newdata) {
|
public TempBlock(final Block block, final Material newtype, final BlockData newData) {
|
||||||
this(block, newdata);
|
this(block, newData, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TempBlock(final Block block, final BlockData newData) {
|
||||||
|
this(block, newData, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TempBlock(final Block block, final BlockData newdata) {
|
public TempBlock(final Block block, final BlockData newData, final long revertTime) {
|
||||||
this.block = block;
|
this.block = block;
|
||||||
this.newdata = newdata;
|
this.newData = newData;
|
||||||
|
this.setRevertTime(revertTime);
|
||||||
if (instances.containsKey(block)) {
|
if (instances.containsKey(block)) {
|
||||||
final TempBlock temp = instances.get(block);
|
final TempBlock temp = instances.get(block);
|
||||||
if (!newdata.equals(temp.block.getBlockData())) {
|
if (!newData.equals(temp.block.getBlockData())) {
|
||||||
temp.block.setBlockData(newdata, GeneralMethods.isLightEmitting(newdata.getMaterial()));
|
temp.block.setBlockData(newData, GeneralMethods.isLightEmitting(newData.getMaterial()));
|
||||||
temp.newdata = newdata;
|
temp.newData = newData;
|
||||||
}
|
}
|
||||||
this.state = temp.state;
|
this.state = temp.state;
|
||||||
instances.put(block, temp);
|
instances.put(block, temp);
|
||||||
|
@ -62,10 +68,7 @@ public class TempBlock {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
instances.put(block, this);
|
instances.put(block, this);
|
||||||
block.setBlockData(newdata, GeneralMethods.isLightEmitting(newdata.getMaterial()));
|
block.setBlockData(newData, GeneralMethods.isLightEmitting(newData.getMaterial()));
|
||||||
}
|
|
||||||
if (this.state.getType() == Material.FIRE) {
|
|
||||||
this.state.setType(Material.AIR);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +142,7 @@ public class TempBlock {
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockData getBlockData() {
|
public BlockData getBlockData() {
|
||||||
return this.newdata;
|
return this.newData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location getLocation() {
|
public Location getLocation() {
|
||||||
|
@ -163,6 +166,10 @@ public class TempBlock {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRevertTime(final long revertTime) {
|
public void setRevertTime(final long revertTime) {
|
||||||
|
if(revertTime <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.inRevertQueue) {
|
if (this.inRevertQueue) {
|
||||||
REVERT_QUEUE.remove(this);
|
REVERT_QUEUE.remove(this);
|
||||||
}
|
}
|
||||||
|
@ -172,7 +179,7 @@ public class TempBlock {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void revertBlock() {
|
public void revertBlock() {
|
||||||
PaperLib.getChunkAtAsync(this.block.getLocation()).thenAccept(result -> this.state.update(true, GeneralMethods.isLightEmitting(this.state.getType())));
|
PaperLib.getChunkAtAsync(this.block.getLocation()).thenAccept(result -> this.state.update(true, GeneralMethods.isLightEmitting(this.state.getType()) || !(state.getBlockData() instanceof Bisected)));
|
||||||
instances.remove(this.block);
|
instances.remove(this.block);
|
||||||
REVERT_QUEUE.remove(this);
|
REVERT_QUEUE.remove(this);
|
||||||
if (this.revertTask != null) {
|
if (this.revertTask != null) {
|
||||||
|
@ -194,7 +201,7 @@ public class TempBlock {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setType(final BlockData data) {
|
public void setType(final BlockData data) {
|
||||||
this.newdata = data;
|
this.newData = data;
|
||||||
this.block.setBlockData(data, GeneralMethods.isLightEmitting(data.getMaterial()));
|
this.block.setBlockData(data, GeneralMethods.isLightEmitting(data.getMaterial()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.bukkit.util.Vector;
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
import com.projectkorra.projectkorra.ProjectKorra;
|
import com.projectkorra.projectkorra.ProjectKorra;
|
||||||
import com.projectkorra.projectkorra.ability.AirAbility;
|
import com.projectkorra.projectkorra.ability.AirAbility;
|
||||||
|
import com.projectkorra.projectkorra.ability.FireAbility;
|
||||||
import com.projectkorra.projectkorra.ability.WaterAbility;
|
import com.projectkorra.projectkorra.ability.WaterAbility;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
import com.projectkorra.projectkorra.avatar.AvatarState;
|
import com.projectkorra.projectkorra.avatar.AvatarState;
|
||||||
|
@ -179,7 +180,7 @@ public class OctopusForm extends WaterAbility {
|
||||||
} else if (!GeneralMethods.isAdjacentToThreeOrMoreSources(this.sourceBlock) && this.sourceBlock != null) {
|
} else if (!GeneralMethods.isAdjacentToThreeOrMoreSources(this.sourceBlock) && this.sourceBlock != null) {
|
||||||
this.sourceBlock.setType(Material.AIR);
|
this.sourceBlock.setType(Material.AIR);
|
||||||
}
|
}
|
||||||
this.source = new TempBlock(this.sourceBlock, Material.WATER, GeneralMethods.getWaterData(0));
|
this.source = new TempBlock(this.sourceBlock, GeneralMethods.getWaterData(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void attack() {
|
private void attack() {
|
||||||
|
@ -253,7 +254,7 @@ public class OctopusForm extends WaterAbility {
|
||||||
this.sourceLocation = newBlock.getLocation();
|
this.sourceLocation = newBlock.getLocation();
|
||||||
|
|
||||||
if (!GeneralMethods.isSolid(newBlock)) {
|
if (!GeneralMethods.isSolid(newBlock)) {
|
||||||
this.source = new TempBlock(newBlock, Material.WATER, GeneralMethods.getWaterData(0));
|
this.source = new TempBlock(newBlock, GeneralMethods.getWaterData(0));
|
||||||
this.sourceBlock = newBlock;
|
this.sourceBlock = newBlock;
|
||||||
} else {
|
} else {
|
||||||
this.remove();
|
this.remove();
|
||||||
|
@ -266,7 +267,7 @@ public class OctopusForm extends WaterAbility {
|
||||||
this.sourceLocation = newBlock.getLocation();
|
this.sourceLocation = newBlock.getLocation();
|
||||||
|
|
||||||
if (!GeneralMethods.isSolid(newBlock)) {
|
if (!GeneralMethods.isSolid(newBlock)) {
|
||||||
this.source = new TempBlock(newBlock, Material.WATER, GeneralMethods.getWaterData(0));
|
this.source = new TempBlock(newBlock, GeneralMethods.getWaterData(0));
|
||||||
this.sourceBlock = newBlock;
|
this.sourceBlock = newBlock;
|
||||||
} else {
|
} else {
|
||||||
this.remove();
|
this.remove();
|
||||||
|
@ -282,7 +283,7 @@ public class OctopusForm extends WaterAbility {
|
||||||
this.source.revertBlock();
|
this.source.revertBlock();
|
||||||
}
|
}
|
||||||
if (!GeneralMethods.isSolid(newBlock)) {
|
if (!GeneralMethods.isSolid(newBlock)) {
|
||||||
this.source = new TempBlock(newBlock, Material.WATER, GeneralMethods.getWaterData(0));
|
this.source = new TempBlock(newBlock, GeneralMethods.getWaterData(0));
|
||||||
this.sourceBlock = newBlock;
|
this.sourceBlock = newBlock;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -426,16 +427,16 @@ public class OctopusForm extends WaterAbility {
|
||||||
if (!SurgeWave.canThaw(block)) {
|
if (!SurgeWave.canThaw(block)) {
|
||||||
SurgeWave.thaw(block);
|
SurgeWave.thaw(block);
|
||||||
}
|
}
|
||||||
tblock.setType(Material.WATER, GeneralMethods.getWaterData(0));
|
tblock.setType(GeneralMethods.getWaterData(0));
|
||||||
this.newBlocks.add(tblock);
|
this.newBlocks.add(tblock);
|
||||||
} else if (this.blocks.contains(tblock)) {
|
} else if (this.blocks.contains(tblock)) {
|
||||||
this.newBlocks.add(tblock);
|
this.newBlocks.add(tblock);
|
||||||
}
|
}
|
||||||
} else if (this.isWaterbendable(this.player, block) || block.getType() == Material.FIRE || isAir(block.getType())) {
|
} else if (this.isWaterbendable(this.player, block) || FireAbility.isFire(block.getType()) || isAir(block.getType())) {
|
||||||
if (isWater(block) && !TempBlock.isTempBlock(block)) {
|
if (isWater(block) && !TempBlock.isTempBlock(block)) {
|
||||||
ParticleEffect.WATER_BUBBLE.display(block.getLocation().clone().add(0.5, 0.5, 0.5), 5, Math.random(), Math.random(), Math.random(), 0);
|
ParticleEffect.WATER_BUBBLE.display(block.getLocation().clone().add(0.5, 0.5, 0.5), 5, Math.random(), Math.random(), Math.random(), 0);
|
||||||
}
|
}
|
||||||
this.newBlocks.add(new TempBlock(block, Material.WATER, GeneralMethods.getWaterData(0)));
|
this.newBlocks.add(new TempBlock(block, GeneralMethods.getWaterData(0)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ 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.ElementalAbility;
|
import com.projectkorra.projectkorra.ability.ElementalAbility;
|
||||||
|
import com.projectkorra.projectkorra.ability.FireAbility;
|
||||||
import com.projectkorra.projectkorra.ability.WaterAbility;
|
import com.projectkorra.projectkorra.ability.WaterAbility;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
import com.projectkorra.projectkorra.firebending.FireBlast;
|
import com.projectkorra.projectkorra.firebending.FireBlast;
|
||||||
|
@ -269,7 +270,7 @@ public class SurgeWall extends WaterAbility {
|
||||||
continue;
|
continue;
|
||||||
} else if (WALL_BLOCKS.containsKey(block)) {
|
} else if (WALL_BLOCKS.containsKey(block)) {
|
||||||
blocks.add(block);
|
blocks.add(block);
|
||||||
} else if (!blocks.contains(block) && (ElementalAbility.isAir(block.getType()) || block.getType() == Material.FIRE || this.isWaterbendable(block)) && this.isTransparent(block)) {
|
} else if (!blocks.contains(block) && (ElementalAbility.isAir(block.getType()) || FireAbility.isFire(block.getType()) || this.isWaterbendable(block)) && this.isTransparent(block)) {
|
||||||
WALL_BLOCKS.put(block, this.player);
|
WALL_BLOCKS.put(block, this.player);
|
||||||
this.addWallBlock(block);
|
this.addWallBlock(block);
|
||||||
blocks.add(block);
|
blocks.add(block);
|
||||||
|
|
|
@ -18,6 +18,7 @@ import org.bukkit.util.Vector;
|
||||||
import com.projectkorra.projectkorra.GeneralMethods;
|
import com.projectkorra.projectkorra.GeneralMethods;
|
||||||
import com.projectkorra.projectkorra.ability.AirAbility;
|
import com.projectkorra.projectkorra.ability.AirAbility;
|
||||||
import com.projectkorra.projectkorra.ability.ElementalAbility;
|
import com.projectkorra.projectkorra.ability.ElementalAbility;
|
||||||
|
import com.projectkorra.projectkorra.ability.FireAbility;
|
||||||
import com.projectkorra.projectkorra.ability.WaterAbility;
|
import com.projectkorra.projectkorra.ability.WaterAbility;
|
||||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||||
import com.projectkorra.projectkorra.avatar.AvatarState;
|
import com.projectkorra.projectkorra.avatar.AvatarState;
|
||||||
|
@ -170,7 +171,7 @@ public class SurgeWave extends WaterAbility {
|
||||||
}
|
}
|
||||||
|
|
||||||
final Block oldBlock = block;
|
final Block oldBlock = block;
|
||||||
if (!ElementalAbility.isAir(block.getType()) && block.getType() != Material.SNOW && !isWater(block) && !isPlant(block)) {
|
if (!isAir(block.getType()) && block.getType() != Material.SNOW && !isWater(block) && !isPlant(block)) {
|
||||||
continue;
|
continue;
|
||||||
} else if (isPlant(block)) {
|
} else if (isPlant(block)) {
|
||||||
block.breakNaturally();
|
block.breakNaturally();
|
||||||
|
@ -293,13 +294,13 @@ public class SurgeWave extends WaterAbility {
|
||||||
final Block blockl = this.location.getBlock();
|
final Block blockl = this.location.getBlock();
|
||||||
final ArrayList<Block> blocks = new ArrayList<Block>();
|
final ArrayList<Block> blocks = new ArrayList<Block>();
|
||||||
|
|
||||||
if (!GeneralMethods.isRegionProtectedFromBuild(this, this.location) && (((ElementalAbility.isAir(blockl.getType()) || blockl.getType() == Material.FIRE || isPlant(blockl) || isWater(blockl) || this.isWaterbendable(this.player, blockl))))) {
|
if (!GeneralMethods.isRegionProtectedFromBuild(this, this.location) && (((isAir(blockl.getType()) || blockl.getType() == Material.FIRE || isPlant(blockl) || isWater(blockl) || this.isWaterbendable(this.player, blockl))))) {
|
||||||
for (double i = 0; i <= this.currentRadius; i += .5) {
|
for (double i = 0; i <= this.currentRadius; i += .5) {
|
||||||
for (double angle = 0; angle < 360; angle += 10) {
|
for (double angle = 0; angle < 360; angle += 10) {
|
||||||
final Vector vec = GeneralMethods.getOrthogonalVector(this.targetDirection, angle, i);
|
final Vector vec = GeneralMethods.getOrthogonalVector(this.targetDirection, angle, i);
|
||||||
final Block block = this.location.clone().add(vec).getBlock();
|
final Block block = this.location.clone().add(vec).getBlock();
|
||||||
|
|
||||||
if (!blocks.contains(block) && (ElementalAbility.isAir(block.getType()) || block.getType() == Material.FIRE) || this.isWaterbendable(block)) {
|
if (!blocks.contains(block) && (isAir(block.getType()) || isFire(block.getType())) || this.isWaterbendable(block)) {
|
||||||
blocks.add(block);
|
blocks.add(block);
|
||||||
FireBlast.removeFireBlastsAroundPoint(block.getLocation(), 2);
|
FireBlast.removeFireBlastsAroundPoint(block.getLocation(), 2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,4 +138,4 @@ public class PlantRegrowth extends PlantAbility {
|
||||||
this.block = block;
|
this.block = block;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -24,6 +24,7 @@ permissions:
|
||||||
bending.ability.AvatarState: true
|
bending.ability.AvatarState: true
|
||||||
bending.water.bloodbending.anytime: true
|
bending.water.bloodbending.anytime: true
|
||||||
bending.water.bloodbending: true
|
bending.water.bloodbending: true
|
||||||
|
bending.fire.bluefire: true
|
||||||
bending.ability.Flight: true
|
bending.ability.Flight: true
|
||||||
bending.ability.MetalClips.loot: true
|
bending.ability.MetalClips.loot: true
|
||||||
bending.ability.MetalClips.4clips: true
|
bending.ability.MetalClips.4clips: true
|
||||||
|
|
Loading…
Reference in a new issue