mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-05-15 17:31:26 +00:00
c12e0daebb
For Spigot 1.14.4+ ## General Gameplay ### Additions - Added default Suffocate cooldown: 6.5 seconds - Added kinetic damage tracker to AirSweep - Added self and others push strength options for AirSuction - Added config option for multiple blocks to be changed per EarthTunnel run, allowing for much faster earth tunnels - Added config to ignore ores completely for EarthTunnel (good for mining) - Added AllowSnow config option for IceBlast - Added AvatarStateCooldown config options for IceBlast and IceBullet - Added config option for ice trapping abilities to not place blocks in players head or feet ### Fixes - Fixed preset command not allowing page numbers higher than 1 - Fixed Catapult and MetalClips not respecting /b invincible - Fixed Charged FireBlast radius and cooldown - Fixed Suffocate being usable through walls - Fixed FireBlast ignoring particle radius options - Fixed FireBurst fragmenting (not looking like a single burst) - Fixed AirSweep knockback to be more consistent (lessened friction) - Fixed AirBlast knockback using wrong push options - Fixed EarthSmash using nonexistent AvatarState options - Fixed error when switching worlds with PhaseChange active - Fixed server crash when hitting falling blocks with high-velocity abilities - Fixed server crash when using EarthGrab over the void - Fixed EarthTunnel not using configurable revert time - Fixed EarthPillars persisting when no entities were around ### Changes - Improved pathing for EarthBlast; works more consistently and can be used from ceilings - Improved aiming for EarthBlast and IceBlast - Changed AirSwipe and AirSweep to originate from the player’s main hand - Changed AirBlast knockback calculations; made the push options affect knockback more directly - Changed EarthTunnel to use tempblocks properly - Moved core combo instructions to config ### Removals - Removed being able to use Lightning while using FireJet - Removed jukeboxes being tempblocks - Removed bending.command.import permission from plugin.yml ## API ### Additions - Added GeneralMethods#getMainHandLocation(Player) - Added GeneralMethods#getClosestEntity(Location, double) - Added GeneralMethods#getClosestLivingEntity(Location, double) - Added "large" abilities collision with each other - Added specific timings for hot spots in the code that should help server owners diagnose lag from PK + player move event + physics event + bending manager - Created local folder repo and update pom for local jar files, this is necessary to use the maven shade plugin. - Added check for concrete powder in move earth - Added PlaceholderAPI support (hopefully more to come) + %projectkorra_slot<1-9>% ability on slot <1-9> + %projectkorra_element% element of the player + %projectkorra_elementcolor% color of the player’s element + %projectkorra_elements% elements the player has - Added "bending" WorldGuard flag. + Used for allowing or denying bending in worldguard regions. Will fall back to the old method of the build flag if the custom flag fails to register or isn't set ### Fixes - Fixed calls to CoreAbility#isEnabled() causing NullPointerExceptions when a CoreAbility is not enabled ### Changes - Changed CoreAbility#getAbility(..) Javadocs to state when it returns null - Formatted codebase - Changed GeneralMethods#getEntitiesAroundPoint() use spigot method for entities around point, should be more optimized - Optimizations to water and air spout to not continually set flying - Optimized revertchecker to not use block.getChunk; this will load the chunk on the server and instead use hashmap of coords - Optimized revertchecker to use paperlib to allow servers running paperspigot to load the chunk for a revert block async - Optimized tempblock revert to load chunk async before updating stateOptimize move event to ignore head movements without directional movement - Optimized physics event to check for air prior to checking for tempblocks - Optimized tempblock set/revert to not apply physics for blocks that don't emit light - Optimize isWater to check for actual water blocks first - Optimize PhaseChange list check, hot spot due to being called in physics event ### Removals - Removed BindChangeEvent; never called or used - Removed HorizontalVelocityTracker that has lasted over 30 seconds, also don't create a tracker for non-living entities
183 lines
5.4 KiB
Java
183 lines
5.4 KiB
Java
package com.projectkorra.projectkorra.ability;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
import org.bukkit.Location;
|
|
import org.bukkit.Material;
|
|
import org.bukkit.Sound;
|
|
import org.bukkit.entity.Entity;
|
|
import org.bukkit.entity.Player;
|
|
|
|
import com.projectkorra.projectkorra.Element;
|
|
import com.projectkorra.projectkorra.GeneralMethods;
|
|
import com.projectkorra.projectkorra.ProjectKorra;
|
|
import com.projectkorra.projectkorra.ability.util.Collision;
|
|
import com.projectkorra.projectkorra.airbending.AirSpout;
|
|
import com.projectkorra.projectkorra.airbending.Suffocate;
|
|
import com.projectkorra.projectkorra.util.ParticleEffect;
|
|
|
|
public abstract class AirAbility extends ElementalAbility {
|
|
|
|
public AirAbility(final Player player) {
|
|
super(player);
|
|
}
|
|
|
|
@Override
|
|
public boolean isIgniteAbility() {
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public boolean isExplosiveAbility() {
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public Element getElement() {
|
|
return Element.AIR;
|
|
}
|
|
|
|
@Override
|
|
public void handleCollision(final Collision collision) {
|
|
super.handleCollision(collision);
|
|
if (collision.isRemovingFirst()) {
|
|
ParticleEffect.BLOCK_CRACK.display(collision.getLocationFirst(), 10, 1, 1, 1, 0.1, Material.WHITE_WOOL.createBlockData());
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Breaks a breathbendng hold on an entity or one a player is inflicting on
|
|
* an entity.
|
|
*
|
|
* @param entity The entity to be acted upon
|
|
*/
|
|
public static void breakBreathbendingHold(final Entity entity) {
|
|
if (Suffocate.isBreathbent(entity)) {
|
|
Suffocate.breakSuffocate(entity);
|
|
return;
|
|
}
|
|
|
|
if (entity instanceof Player) {
|
|
final Player player = (Player) entity;
|
|
if (Suffocate.isChannelingSphere(player)) {
|
|
Suffocate.remove(player);
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Gets the Air Particles from the config.
|
|
*
|
|
* @return Config specified ParticleEffect
|
|
*/
|
|
public static ParticleEffect getAirbendingParticles() {
|
|
final String particle = getConfig().getString("Properties.Air.Particles");
|
|
if (particle == null) {
|
|
return ParticleEffect.CLOUD;
|
|
} else if (particle.equalsIgnoreCase("spell")) {
|
|
return ParticleEffect.SPELL;
|
|
} else if (particle.equalsIgnoreCase("blacksmoke")) {
|
|
return ParticleEffect.SMOKE_NORMAL;
|
|
} else if (particle.equalsIgnoreCase("smoke")) {
|
|
return ParticleEffect.CLOUD;
|
|
} else if (particle.equalsIgnoreCase("smallsmoke")) {
|
|
return ParticleEffect.SNOW_SHOVEL;
|
|
} else {
|
|
return ParticleEffect.CLOUD;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* This method was used for the old collision detection system. Please see
|
|
* {@link Collision} for the new system.
|
|
* <p>
|
|
* Checks whether a location is within an AirShield.
|
|
*
|
|
* @param loc The location to check
|
|
* @return true If the location is inside an AirShield.
|
|
*/
|
|
@Deprecated
|
|
public static boolean isWithinAirShield(final Location loc) {
|
|
final List<String> list = new ArrayList<String>();
|
|
list.add("AirShield");
|
|
return GeneralMethods.blockAbilities(null, list, loc, 0);
|
|
}
|
|
|
|
/**
|
|
* Plays an integer amount of air particles in a location.
|
|
*
|
|
* @param loc The location to use
|
|
* @param amount The amount of particles
|
|
*/
|
|
public static void playAirbendingParticles(final Location loc, final int amount) {
|
|
playAirbendingParticles(loc, amount, Math.random(), Math.random(), Math.random());
|
|
}
|
|
|
|
/**
|
|
* Plays an integer amount of air particles in a location with a given
|
|
* xOffset, yOffset, and zOffset.
|
|
*
|
|
* @param loc The location to use
|
|
* @param amount The amount of particles
|
|
* @param xOffset The xOffset to use
|
|
* @param yOffset The yOffset to use
|
|
* @param zOffset The zOffset to use
|
|
*/
|
|
public static void playAirbendingParticles(final Location loc, final int amount, final double xOffset, final double yOffset, final double zOffset) {
|
|
getAirbendingParticles().display(loc, amount, xOffset, yOffset, zOffset);
|
|
}
|
|
|
|
/**
|
|
* Plays the Airbending Sound at a location if enabled in the config.
|
|
*
|
|
* @param loc The location to play the sound at
|
|
*/
|
|
public static void playAirbendingSound(final Location loc) {
|
|
if (getConfig().getBoolean("Properties.Air.PlaySound")) {
|
|
final float volume = (float) getConfig().getDouble("Properties.Air.Sound.Volume");
|
|
final float pitch = (float) getConfig().getDouble("Properties.Air.Sound.Pitch");
|
|
|
|
Sound sound = Sound.ENTITY_CREEPER_HURT;
|
|
|
|
try {
|
|
sound = Sound.valueOf(getConfig().getString("Properties.Air.Sound.Sound"));
|
|
} catch (final IllegalArgumentException exception) {
|
|
ProjectKorra.log.warning("Your current value for 'Properties.Air.Sound.Sound' is not valid.");
|
|
} finally {
|
|
loc.getWorld().playSound(loc, sound, volume, pitch);
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* This method was used for the old collision detection system. Please see
|
|
* {@link Collision} for the new system.
|
|
* <p>
|
|
* Removes all air spouts in a location within a certain radius.
|
|
*
|
|
* @param loc The location to use
|
|
* @param radius The radius around the location to remove spouts in
|
|
* @param source The player causing the removal
|
|
*/
|
|
@Deprecated
|
|
public static void removeAirSpouts(final Location loc, final double radius, final Player source) {
|
|
AirSpout.removeSpouts(loc, radius, source);
|
|
}
|
|
|
|
/**
|
|
* This method was used for the old collision detection system. Please see
|
|
* {@link Collision} for the new system.
|
|
* <p>
|
|
* Removes all air spouts in a location with a radius of 1.5.
|
|
*
|
|
* @param loc The location to use
|
|
* @param source The player causing the removal
|
|
*/
|
|
@Deprecated
|
|
public static void removeAirSpouts(final Location loc, final Player source) {
|
|
removeAirSpouts(loc, 1.5, source);
|
|
}
|
|
|
|
}
|