mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-08-17 08:57:40 +00:00
Merge remote-tracking branch 'refs/remotes/ProjectKorra/master'
This commit is contained in:
commit
c2f471a346
|
@ -39,6 +39,7 @@ import org.bukkit.World;
|
|||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
|
@ -344,22 +345,19 @@ public class GeneralMethods {
|
|||
}
|
||||
}
|
||||
|
||||
public static void damageEntity(Ability ability, Entity entity, double damage) {
|
||||
damageEntity(ability.getPlayer(), entity, damage, ability.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Damages an Entity by amount of damage specified. Starts a
|
||||
* {@link EntityDamageByEntityEvent}.
|
||||
*
|
||||
* @param player The player dealing the damage
|
||||
* @param ability The ability that is used to damage the entity
|
||||
* @param entity The entity that is receiving the damage
|
||||
* @param damage The amount of damage to deal
|
||||
* @param element The element of the ability
|
||||
* @param ability The ability that is used to damage the entity
|
||||
*/
|
||||
public static void damageEntity(Player player, Entity entity, double damage, String ability) {
|
||||
AbilityDamageEntityEvent damageEvent = new AbilityDamageEntityEvent(entity, CoreAbility.getAbility(player, CoreAbility.getAbility(ability).getClass()), damage);
|
||||
public static void damageEntity(Ability ability, Entity entity, double damage) {
|
||||
if (ability==null)
|
||||
return;
|
||||
Player player = ability.getPlayer();
|
||||
AbilityDamageEntityEvent damageEvent = new AbilityDamageEntityEvent(entity, ability, damage);
|
||||
Bukkit.getServer().getPluginManager().callEvent(damageEvent);
|
||||
if (entity instanceof LivingEntity) {
|
||||
if (entity instanceof Player && Commands.invincible.contains(entity.getName())) {
|
||||
|
@ -371,7 +369,7 @@ public class GeneralMethods {
|
|||
NCPExemptionManager.exemptPermanently(player, CheckType.FIGHT_REACH);
|
||||
}
|
||||
if (((LivingEntity) entity).getHealth() - damage <= 0 && !entity.isDead()) {
|
||||
EntityBendingDeathEvent deathEvent = new EntityBendingDeathEvent(entity, player, damage, ability);
|
||||
EntityBendingDeathEvent deathEvent = new EntityBendingDeathEvent(entity, damage, ability);
|
||||
Bukkit.getServer().getPluginManager().callEvent(deathEvent);
|
||||
}
|
||||
((LivingEntity) entity).damage(damage, player);
|
||||
|
@ -1228,10 +1226,14 @@ public class GeneralMethods {
|
|||
return mat != null && (mat == Material.WOOD_AXE || mat == Material.WOOD_PICKAXE || mat == Material.WOOD_SPADE || mat == Material.WOOD_SWORD || mat == Material.STONE_AXE || mat == Material.STONE_PICKAXE || mat == Material.STONE_SPADE || mat == Material.STONE_SWORD || mat == Material.IRON_AXE || mat == Material.IRON_PICKAXE || mat == Material.IRON_SWORD || mat == Material.IRON_SPADE || mat == Material.DIAMOND_AXE || mat == Material.DIAMOND_PICKAXE || mat == Material.DIAMOND_SWORD || mat == Material.DIAMOND_SPADE);
|
||||
}
|
||||
|
||||
public static void reloadPlugin() {
|
||||
public static void reloadPlugin(CommandSender sender) {
|
||||
ProjectKorra.log.info("Reloading ProjectKorra and configuration");
|
||||
BendingReloadEvent event = new BendingReloadEvent();
|
||||
BendingReloadEvent event = new BendingReloadEvent(sender);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) {
|
||||
sender.sendMessage(ChatColor.RED + "Reload event cancelled");
|
||||
return;
|
||||
}
|
||||
if (DBConnection.isOpen) {
|
||||
DBConnection.sql.close();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,68 @@
|
|||
package com.projectkorra.projectkorra;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockFadeEvent;
|
||||
import org.bukkit.event.block.BlockFormEvent;
|
||||
import org.bukkit.event.block.BlockFromToEvent;
|
||||
import org.bukkit.event.block.BlockIgniteEvent;
|
||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
import org.bukkit.event.entity.EntityCombustEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.EntityInteractEvent;
|
||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
|
||||
import org.bukkit.event.entity.EntityTeleportEvent;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||
import org.bukkit.event.entity.SlimeSplitEvent;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryType.SlotType;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerAnimationEvent;
|
||||
import org.bukkit.event.player.PlayerGameModeChangeEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerKickEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerToggleFlightEvent;
|
||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.projectkorra.projectkorra.ability.Ability;
|
||||
import com.projectkorra.projectkorra.ability.AddonAbility;
|
||||
import com.projectkorra.projectkorra.ability.AirAbility;
|
||||
import com.projectkorra.projectkorra.ability.ChiAbility;
|
||||
|
@ -95,68 +158,6 @@ import com.projectkorra.projectkorra.waterbending.WaterPassive;
|
|||
import com.projectkorra.projectkorra.waterbending.WaterSpout;
|
||||
import com.projectkorra.projectkorra.waterbending.WaterSpoutWave;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockFadeEvent;
|
||||
import org.bukkit.event.block.BlockFormEvent;
|
||||
import org.bukkit.event.block.BlockFromToEvent;
|
||||
import org.bukkit.event.block.BlockIgniteEvent;
|
||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
import org.bukkit.event.entity.EntityCombustEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.EntityInteractEvent;
|
||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
|
||||
import org.bukkit.event.entity.EntityTeleportEvent;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||
import org.bukkit.event.entity.SlimeSplitEvent;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryType.SlotType;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerAnimationEvent;
|
||||
import org.bukkit.event.player.PlayerGameModeChangeEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerKickEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerToggleFlightEvent;
|
||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public class PKListener implements Listener {
|
||||
|
||||
ProjectKorra plugin;
|
||||
|
@ -698,9 +699,9 @@ public class PKListener implements Listener {
|
|||
double damage = ((e.getDistanceTraveled() - minimumDistance) < 0 ? 0 : e.getDistanceTraveled() - minimumDistance) / (e.getDifference().length());
|
||||
if (damage > 0) {
|
||||
if(damage <= maxDamage) {
|
||||
GeneralMethods.damageEntity(e.getInstigator(), e.getEntity(), damage, e.getAbility());
|
||||
GeneralMethods.damageEntity(e.getAbility(), e.getEntity(), damage);
|
||||
} else {
|
||||
GeneralMethods.damageEntity(e.getInstigator(), e.getEntity(), maxDamage, e.getAbility());
|
||||
GeneralMethods.damageEntity(e.getAbility(), e.getEntity(), maxDamage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -730,8 +731,8 @@ public class PKListener implements Listener {
|
|||
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
public void onPlayerBendingDeath(EntityBendingDeathEvent event) {
|
||||
if (ConfigManager.deathMsgConfig.get().getBoolean("Properties.Enabled") && event.getVictim() instanceof Player) {
|
||||
CoreAbility ability = CoreAbility.getAbility(event.getAbility());
|
||||
if (ConfigManager.deathMsgConfig.get().getBoolean("Properties.Enabled") && event.getEntity() instanceof Player) {
|
||||
Ability ability = event.getAbility();
|
||||
|
||||
if (ability == null) {
|
||||
return;
|
||||
|
@ -740,8 +741,8 @@ public class PKListener implements Listener {
|
|||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(ability.getElement().getColor());
|
||||
sb.append(event.getAbility());
|
||||
BENDING_PLAYER_DEATH.put((Player) event.getVictim(), sb.toString());
|
||||
final Player player = (Player) event.getVictim();
|
||||
BENDING_PLAYER_DEATH.put((Player) event.getEntity(), sb.toString());
|
||||
final Player player = (Player) event.getEntity();
|
||||
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
|
@ -849,7 +850,7 @@ public class PKListener implements Listener {
|
|||
Player source = Flight.getLaunchedBy(player);
|
||||
if (source != null) {
|
||||
event.setCancelled(true);
|
||||
GeneralMethods.damageEntity(source, player, event.getDamage(), null);
|
||||
GeneralMethods.damageEntity(null, player, event.getDamage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
package com.projectkorra.projectkorra.airbending;
|
||||
|
||||
import com.projectkorra.projectkorra.BendingPlayer;
|
||||
import com.projectkorra.projectkorra.Element;
|
||||
import com.projectkorra.projectkorra.GeneralMethods;
|
||||
import com.projectkorra.projectkorra.ProjectKorra;
|
||||
import com.projectkorra.projectkorra.ability.AirAbility;
|
||||
import com.projectkorra.projectkorra.avatar.AvatarState;
|
||||
import com.projectkorra.projectkorra.command.Commands;
|
||||
import com.projectkorra.projectkorra.object.HorizontalVelocityTracker;
|
||||
import com.projectkorra.projectkorra.util.Flight;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
|
@ -25,10 +20,14 @@ import org.bukkit.material.Lever;
|
|||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import com.projectkorra.projectkorra.BendingPlayer;
|
||||
import com.projectkorra.projectkorra.GeneralMethods;
|
||||
import com.projectkorra.projectkorra.ProjectKorra;
|
||||
import com.projectkorra.projectkorra.ability.AirAbility;
|
||||
import com.projectkorra.projectkorra.avatar.AvatarState;
|
||||
import com.projectkorra.projectkorra.command.Commands;
|
||||
import com.projectkorra.projectkorra.object.HorizontalVelocityTracker;
|
||||
import com.projectkorra.projectkorra.util.Flight;
|
||||
|
||||
public class AirBlast extends AirAbility {
|
||||
|
||||
|
@ -237,9 +236,9 @@ public class AirBlast extends AirAbility {
|
|||
|
||||
GeneralMethods.setVelocity(entity, velocity);
|
||||
if (source != null) {
|
||||
new HorizontalVelocityTracker(entity, player, 200l, "AirBurst", Element.AIR);
|
||||
new HorizontalVelocityTracker(entity, player, 200l, this);
|
||||
} else {
|
||||
new HorizontalVelocityTracker(entity, player, 200l, "AirBlast", Element.AIR);
|
||||
new HorizontalVelocityTracker(entity, player, 200l, this);
|
||||
}
|
||||
|
||||
entity.setFallDistance(0);
|
||||
|
@ -254,7 +253,7 @@ public class AirBlast extends AirAbility {
|
|||
breakBreathbendingHold(entity);
|
||||
|
||||
if (source != null && (this.damage > 0 && entity instanceof LivingEntity && !entity.equals(player) && !affectedEntities.contains(entity))) {
|
||||
GeneralMethods.damageEntity(player, entity, damage, "AirBurst");
|
||||
GeneralMethods.damageEntity(this, entity, damage);
|
||||
affectedEntities.add(entity);
|
||||
} else if (source == null && (damage > 0 && entity instanceof LivingEntity && !entity.equals(player) && !affectedEntities.contains(entity))) {
|
||||
GeneralMethods.damageEntity(this, entity, damage);
|
||||
|
|
|
@ -1,7 +1,15 @@
|
|||
package com.projectkorra.projectkorra.airbending;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.projectkorra.projectkorra.BendingPlayer;
|
||||
import com.projectkorra.projectkorra.Element;
|
||||
import com.projectkorra.projectkorra.GeneralMethods;
|
||||
import com.projectkorra.projectkorra.ProjectKorra;
|
||||
import com.projectkorra.projectkorra.ability.AirAbility;
|
||||
|
@ -11,15 +19,6 @@ import com.projectkorra.projectkorra.object.HorizontalVelocityTracker;
|
|||
import com.projectkorra.projectkorra.util.Flight;
|
||||
import com.projectkorra.projectkorra.waterbending.WaterSpout;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class AirSuction extends AirAbility {
|
||||
|
||||
private static final int MAX_TICKS = 10000;
|
||||
|
@ -200,7 +199,7 @@ public class AirSuction extends AirAbility {
|
|||
}
|
||||
|
||||
GeneralMethods.setVelocity(entity, velocity);
|
||||
new HorizontalVelocityTracker(entity, player, 200l, "AirSuction", Element.AIR);
|
||||
new HorizontalVelocityTracker(entity, player, 200l, this);
|
||||
entity.setFallDistance(0);
|
||||
if (entity.getEntityId() != player.getEntityId() && entity instanceof Player) {
|
||||
new Flight((Player) entity, player);
|
||||
|
|
|
@ -48,6 +48,7 @@ public class AirSwipe extends AirAbility {
|
|||
private double maxChargeFactor;
|
||||
private Location origin;
|
||||
private Random random;
|
||||
private AirSwipe ability;
|
||||
private ConcurrentHashMap<Vector, Location> elements;
|
||||
private ArrayList<Entity> affectedEntities;
|
||||
|
||||
|
@ -58,6 +59,7 @@ public class AirSwipe extends AirAbility {
|
|||
public AirSwipe(Player player, boolean charging) {
|
||||
super(player);
|
||||
|
||||
ability = this;
|
||||
this.charging = charging;
|
||||
this.origin = player.getEyeLocation();
|
||||
this.charging = false;
|
||||
|
@ -194,7 +196,7 @@ public class AirSwipe extends AirAbility {
|
|||
}
|
||||
if (entity instanceof LivingEntity && !affectedEntities.contains(entity)) {
|
||||
if (damage != 0) {
|
||||
GeneralMethods.damageEntity(player, entity, damage, "AirSwipe");
|
||||
GeneralMethods.damageEntity(ability, entity, damage);
|
||||
}
|
||||
affectedEntities.add(entity);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
package com.projectkorra.projectkorra.airbending;
|
||||
|
||||
import com.projectkorra.projectkorra.GeneralMethods;
|
||||
import com.projectkorra.projectkorra.ProjectKorra;
|
||||
import com.projectkorra.projectkorra.ability.AirAbility;
|
||||
import com.projectkorra.projectkorra.avatar.AvatarState;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
@ -13,8 +11,10 @@ import org.bukkit.potion.PotionEffect;
|
|||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import com.projectkorra.projectkorra.GeneralMethods;
|
||||
import com.projectkorra.projectkorra.ProjectKorra;
|
||||
import com.projectkorra.projectkorra.ability.AirAbility;
|
||||
import com.projectkorra.projectkorra.avatar.AvatarState;
|
||||
|
||||
/**
|
||||
* Suffocate
|
||||
|
@ -50,11 +50,13 @@ public class Suffocate extends AirAbility {
|
|||
private double blindDelay;
|
||||
private double blindRepeat;
|
||||
private double animationSpeed;
|
||||
private Suffocate ability;
|
||||
private ArrayList<BukkitRunnable> tasks;
|
||||
private ArrayList<LivingEntity> targets;
|
||||
|
||||
public Suffocate(Player player) {
|
||||
super(player);
|
||||
ability = this;
|
||||
if (bPlayer.isOnCooldown(this)) {
|
||||
return;
|
||||
} else if (hasAbility(player, Suffocate.class)) {
|
||||
|
@ -189,13 +191,12 @@ public class Suffocate extends AirAbility {
|
|||
return;
|
||||
} else if (!started) {
|
||||
started = true;
|
||||
final Player fplayer = player;
|
||||
for (LivingEntity targ : targets) {
|
||||
final LivingEntity target = targ;
|
||||
BukkitRunnable br1 = new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
GeneralMethods.damageEntity(fplayer, target, damage, "Suffocate");
|
||||
GeneralMethods.damageEntity(ability, target, damage);
|
||||
}
|
||||
};
|
||||
BukkitRunnable br2 = new BukkitRunnable() {
|
||||
|
|
|
@ -55,7 +55,9 @@ public class ChiCombo extends ChiAbility implements ComboAbility {
|
|||
* @param duration The time in milliseconds the target will be paralyzed
|
||||
*/
|
||||
private static void paralyze(Entity target, Long duration) {
|
||||
PARALYZED_ENTITIES.put(target, (System.currentTimeMillis() + duration));
|
||||
if (target != null) {
|
||||
PARALYZED_ENTITIES.put(target, (System.currentTimeMillis() + duration));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -86,6 +88,7 @@ public class ChiCombo extends ChiAbility implements ComboAbility {
|
|||
*/
|
||||
public static void handleParalysis() {
|
||||
for (Entity entity : PARALYZED_ENTITIES.keySet()) {
|
||||
entity.setFallDistance(0);
|
||||
if (PARALYZED_ENTITIES.get(entity) <= System.currentTimeMillis()) {
|
||||
PARALYZED_ENTITIES.remove(entity);
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ public class ReloadCommand extends PKCommand {
|
|||
if (!hasPermission(sender) || !correctLength(sender, args.size(), 0, 0)) {
|
||||
return;
|
||||
}
|
||||
GeneralMethods.reloadPlugin();
|
||||
GeneralMethods.reloadPlugin(sender);
|
||||
sender.sendMessage(ChatColor.AQUA + "Bending config reloaded.");
|
||||
}
|
||||
|
||||
|
|
|
@ -550,7 +550,7 @@ public class EarthSmash extends EarthAbility {
|
|||
if (entity instanceof LivingEntity && entity != player && !affectedEntities.contains(entity)) {
|
||||
affectedEntities.add(entity);
|
||||
double damage = currentBlocks.size() / 13.0 * this.damage;
|
||||
GeneralMethods.damageEntity(player, entity, damage, "EarthSmash");
|
||||
GeneralMethods.damageEntity(this, entity, damage);
|
||||
Vector travelVec = GeneralMethods.getDirection(location, entity.getLocation());
|
||||
entity.setVelocity(travelVec.setY(knockup).normalize().multiply(knockback));
|
||||
}
|
||||
|
|
|
@ -257,7 +257,7 @@ public class LavaSurge extends LavaAbility {
|
|||
for(Entity e : GeneralMethods.getEntitiesAroundPoint(fb.getLocation(), 2)) {
|
||||
if(e instanceof LivingEntity) {
|
||||
if(e.getEntityId() != player.getEntityId()) {
|
||||
GeneralMethods.damageEntity(player, e, impactDamage, "LavaSurge");
|
||||
GeneralMethods.damageEntity(this, e, impactDamage);
|
||||
e.setFireTicks(100);
|
||||
GeneralMethods.setVelocity(e, direction.clone());
|
||||
}
|
||||
|
|
|
@ -8,8 +8,6 @@ import java.util.jar.JarFile;
|
|||
|
||||
/**
|
||||
* Called when an ability is successfully loaded.
|
||||
*
|
||||
* @author kingbirdy
|
||||
*/
|
||||
public class AbilityLoadEvent<T> extends Event {
|
||||
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
package com.projectkorra.projectkorra.event;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
/**
|
||||
* Called when the /bending reload command is executed.
|
||||
*
|
||||
* @author kingbirdy
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class BendingReloadEvent extends Event {
|
||||
public class BendingReloadEvent extends Event implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
public BendingReloadEvent() {
|
||||
private boolean cancelled = false;
|
||||
|
||||
public BendingReloadEvent(CommandSender sender) {
|
||||
|
||||
}
|
||||
|
||||
|
@ -24,4 +24,21 @@ public class BendingReloadEvent extends Event {
|
|||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Whether the event is cancelled
|
||||
*/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets if the event is cancelled
|
||||
* @param cancel boolean value indicating whether the event is cancelled or not
|
||||
*/
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
cancelled = cancel;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import org.bukkit.event.HandlerList;
|
|||
*
|
||||
* @author savior67
|
||||
*/
|
||||
public class BindChangeEvent extends Event{
|
||||
public class BindChangeEvent extends Event {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private Player player;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.projectkorra.projectkorra.event;
|
||||
|
||||
import com.projectkorra.projectkorra.GeneralMethods;
|
||||
import com.projectkorra.projectkorra.ability.Ability;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -8,54 +9,51 @@ import org.bukkit.event.Event;
|
|||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a player is killed by {@link GeneralMethods#damageEntity(Player player, Entity entity, double damage, String ability) GeneralMethods.damageEntity}
|
||||
*
|
||||
* @author kingbirdy
|
||||
* Called when an entity is killed by {@link GeneralMethods#damageEntity(Player player, Entity entity, double damage, String ability) GeneralMethods.damageEntity}
|
||||
*/
|
||||
|
||||
public class EntityBendingDeathEvent extends Event {
|
||||
|
||||
public static final HandlerList handlers = new HandlerList();
|
||||
private Entity victim;
|
||||
private Player attacker;
|
||||
private String ability;
|
||||
private Entity entity;
|
||||
private Ability ability;
|
||||
private double damage;
|
||||
|
||||
/**
|
||||
* Creates a new EntityBendingDeathEvent
|
||||
*
|
||||
* @param victim the player who died
|
||||
* @param attacker the player who killed the victim
|
||||
* @param damage the amount of damage done in the attack that killed the victim
|
||||
* @param ability the ability used to kill the victim
|
||||
*/
|
||||
public EntityBendingDeathEvent(Entity victim, Player attacker, double damage, String ability) {
|
||||
this.victim = victim;
|
||||
this.attacker = attacker;
|
||||
public EntityBendingDeathEvent(Entity entity, double damage, Ability ability) {
|
||||
this.entity = entity;
|
||||
this.ability = ability;
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the player who was killed
|
||||
* @return the entity that was killed
|
||||
*/
|
||||
public Entity getVictim() {
|
||||
return victim;
|
||||
public Entity getEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the player who killed the victim
|
||||
* @return the player who killed the entity
|
||||
*/
|
||||
public Player getAttacker() {
|
||||
return attacker;
|
||||
return ability.getPlayer();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the ability used to kill the victim
|
||||
*/
|
||||
public String getAbility() {
|
||||
public Ability getAbility() {
|
||||
return ability;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.projectkorra.projectkorra.event;
|
||||
|
||||
import com.projectkorra.projectkorra.Element;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -10,6 +8,8 @@ import org.bukkit.event.Event;
|
|||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.projectkorra.projectkorra.ability.Ability;
|
||||
|
||||
/**
|
||||
* Created by Carbogen on 2/2/2015.
|
||||
*/
|
||||
|
@ -26,8 +26,7 @@ public class HorizontalVelocityChangeEvent extends Event implements Cancellable
|
|||
private Vector difference;
|
||||
private Location start;
|
||||
private Location end;
|
||||
private String abil;
|
||||
private Element element;
|
||||
private Ability abil;
|
||||
|
||||
@Deprecated
|
||||
public HorizontalVelocityChangeEvent(Entity entity, Player instigator, Vector from, Vector to, Vector difference) {
|
||||
|
@ -38,7 +37,7 @@ public class HorizontalVelocityChangeEvent extends Event implements Cancellable
|
|||
this.difference = difference;
|
||||
}
|
||||
|
||||
public HorizontalVelocityChangeEvent(Entity entity, Player instigator, Vector from, Vector to, Vector difference, Location start, Location end, String ability, Element element) {
|
||||
public HorizontalVelocityChangeEvent(Entity entity, Player instigator, Vector from, Vector to, Vector difference, Location start, Location end, Ability ability) {
|
||||
this.entity = entity;
|
||||
this.instigator = instigator;
|
||||
this.from = from;
|
||||
|
@ -47,7 +46,6 @@ public class HorizontalVelocityChangeEvent extends Event implements Cancellable
|
|||
this.start = start;
|
||||
this.end = end;
|
||||
abil = ability;
|
||||
this.element = element;
|
||||
}
|
||||
|
||||
public Entity getEntity() {
|
||||
|
@ -85,14 +83,10 @@ public class HorizontalVelocityChangeEvent extends Event implements Cancellable
|
|||
return difference;
|
||||
}
|
||||
|
||||
public String getAbility() {
|
||||
public Ability getAbility() {
|
||||
return abil;
|
||||
}
|
||||
|
||||
public Element getElement() {
|
||||
return element;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
|
|
|
@ -9,9 +9,6 @@ import org.bukkit.event.HandlerList;
|
|||
|
||||
/**
|
||||
* Called when a player's bending element is modified
|
||||
*
|
||||
* @author kingbirdy
|
||||
*
|
||||
*/
|
||||
public class PlayerChangeElementEvent extends Event {
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ public class FireBlastCharged extends FireAbility {
|
|||
if (distance > damageRadius) {
|
||||
return;
|
||||
} else if (distance < innerRadius) {
|
||||
GeneralMethods.damageEntity(player, entity, maxDamage, "FireBlast");
|
||||
GeneralMethods.damageEntity(this, entity, maxDamage);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ public class FireDamageTimer {
|
|||
LivingEntity Lentity = (LivingEntity) entity;
|
||||
Player source = INSTANCES.get(entity);
|
||||
if (Lentity.getHealth() - DAMAGE <= 0 && !entity.isDead()) {
|
||||
EntityBendingDeathEvent event = new EntityBendingDeathEvent(entity, source, DAMAGE, CoreAbility.getAbilitiesByElement(Element.FIRE).get(0).getName());
|
||||
EntityBendingDeathEvent event = new EntityBendingDeathEvent(entity, DAMAGE, CoreAbility.getAbilitiesByElement(Element.FIRE).get(0));
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
package com.projectkorra.projectkorra.object;
|
||||
|
||||
import com.projectkorra.projectkorra.Element;
|
||||
import com.projectkorra.projectkorra.GeneralMethods;
|
||||
import com.projectkorra.projectkorra.ProjectKorra;
|
||||
import com.projectkorra.projectkorra.ability.ElementalAbility;
|
||||
import com.projectkorra.projectkorra.ability.WaterAbility;
|
||||
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
||||
import com.projectkorra.projectkorra.event.HorizontalVelocityChangeEvent;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
|
@ -16,8 +11,13 @@ import org.bukkit.entity.Entity;
|
|||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import com.projectkorra.projectkorra.GeneralMethods;
|
||||
import com.projectkorra.projectkorra.ProjectKorra;
|
||||
import com.projectkorra.projectkorra.ability.Ability;
|
||||
import com.projectkorra.projectkorra.ability.ElementalAbility;
|
||||
import com.projectkorra.projectkorra.ability.WaterAbility;
|
||||
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
||||
import com.projectkorra.projectkorra.event.HorizontalVelocityChangeEvent;
|
||||
|
||||
/**
|
||||
* Created by Carbogen on 2/2/2015.
|
||||
|
@ -35,12 +35,11 @@ public class HorizontalVelocityTracker {
|
|||
private Vector thisVelocity;
|
||||
private Location launchLocation;
|
||||
private Location impactLocation;
|
||||
private String abil;
|
||||
private Element e;
|
||||
private Ability abil;
|
||||
|
||||
public static String[] abils = {"AirBlast", "AirBurst", "AirSuction", "Bloodbending"};
|
||||
|
||||
public HorizontalVelocityTracker(Entity e, Player instigator, long delay, String ability, Element element) {
|
||||
public HorizontalVelocityTracker(Entity e, Player instigator, long delay, Ability ability) {
|
||||
if (!ProjectKorra.plugin.getConfig().getBoolean("Properties.HorizontalCollisionPhysics.Enabled"))
|
||||
return;
|
||||
|
||||
|
@ -54,7 +53,6 @@ public class HorizontalVelocityTracker {
|
|||
impactLocation = launchLocation.clone();
|
||||
this.delay = delay;
|
||||
abil = ability;
|
||||
this.e = element;
|
||||
update();
|
||||
instances.put(entity, this);
|
||||
}
|
||||
|
@ -91,7 +89,7 @@ public class HorizontalVelocityTracker {
|
|||
if (GeneralMethods.isSolid(b) && (entity.getLocation().getBlock().getRelative(BlockFace.EAST, 1).equals(b) || entity.getLocation().getBlock().getRelative(BlockFace.NORTH, 1).equals(b) || entity.getLocation().getBlock().getRelative(BlockFace.WEST, 1).equals(b) || entity.getLocation().getBlock().getRelative(BlockFace.SOUTH, 1).equals(b))) {
|
||||
if (!ElementalAbility.isTransparent(instigator, b)) {
|
||||
hasBeenDamaged = true;
|
||||
ProjectKorra.plugin.getServer().getPluginManager().callEvent(new HorizontalVelocityChangeEvent(entity, instigator, lastVelocity, thisVelocity, diff, launchLocation, impactLocation, abil, e));
|
||||
ProjectKorra.plugin.getServer().getPluginManager().callEvent(new HorizontalVelocityChangeEvent(entity, instigator, lastVelocity, thisVelocity, diff, launchLocation, impactLocation, abil));
|
||||
remove();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,13 +1,8 @@
|
|||
package com.projectkorra.projectkorra.waterbending;
|
||||
|
||||
import com.projectkorra.projectkorra.BendingPlayer;
|
||||
import com.projectkorra.projectkorra.Element;
|
||||
import com.projectkorra.projectkorra.GeneralMethods;
|
||||
import com.projectkorra.projectkorra.ability.AirAbility;
|
||||
import com.projectkorra.projectkorra.ability.BloodAbility;
|
||||
import com.projectkorra.projectkorra.avatar.AvatarState;
|
||||
import com.projectkorra.projectkorra.object.HorizontalVelocityTracker;
|
||||
import com.projectkorra.projectkorra.util.TempPotionEffect;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Creature;
|
||||
|
@ -18,9 +13,13 @@ import org.bukkit.potion.PotionEffect;
|
|||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import com.projectkorra.projectkorra.BendingPlayer;
|
||||
import com.projectkorra.projectkorra.GeneralMethods;
|
||||
import com.projectkorra.projectkorra.ability.AirAbility;
|
||||
import com.projectkorra.projectkorra.ability.BloodAbility;
|
||||
import com.projectkorra.projectkorra.avatar.AvatarState;
|
||||
import com.projectkorra.projectkorra.object.HorizontalVelocityTracker;
|
||||
import com.projectkorra.projectkorra.util.TempPotionEffect;
|
||||
|
||||
public class Bloodbending extends BloodAbility {
|
||||
|
||||
|
@ -147,7 +146,7 @@ public class Bloodbending extends BloodAbility {
|
|||
Vector vector = GeneralMethods.getDirection(location, GeneralMethods.getTargetedLocation(player, location.distance(target)));
|
||||
vector.normalize();
|
||||
entity.setVelocity(vector.multiply(throwFactor));
|
||||
new HorizontalVelocityTracker(entity, player, 200, "Bloodbending", Element.AIR);
|
||||
new HorizontalVelocityTracker(entity, player, 200, this);
|
||||
}
|
||||
remove();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue