mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-11 11:40:40 +00:00
Stupid Commit, Will Revert
This commit is contained in:
parent
ef812566da
commit
599ecf6426
16 changed files with 168 additions and 116 deletions
|
@ -0,0 +1,59 @@
|
|||
package com.projectkorra.ProjectKorra.CustomEvents;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class EntityDamageByBendingEvent extends Event implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private Player attacker;
|
||||
private Entity target;
|
||||
private String ability;
|
||||
private double damage;
|
||||
private boolean cancelled = false;
|
||||
|
||||
public EntityDamageByBendingEvent(Player Attacker, Entity Target, String Ability, double Damage) {
|
||||
attacker = Attacker;
|
||||
target = Target;
|
||||
ability = Ability;
|
||||
damage = Damage;
|
||||
}
|
||||
|
||||
public Player getAttacker() {
|
||||
return attacker;
|
||||
}
|
||||
|
||||
public Entity getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
public String getAbilityName() {
|
||||
return ability;
|
||||
}
|
||||
|
||||
public double getDamage() {
|
||||
return damage;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean set) {
|
||||
cancelled = set;
|
||||
}
|
||||
}
|
|
@ -65,6 +65,7 @@ import com.palmergames.bukkit.towny.war.flagwar.TownyWarConfig;
|
|||
import com.projectkorra.ProjectKorra.Ability.AbilityModule;
|
||||
import com.projectkorra.ProjectKorra.Ability.AbilityModuleManager;
|
||||
import com.projectkorra.ProjectKorra.Ability.AvatarState;
|
||||
import com.projectkorra.ProjectKorra.CustomEvents.EntityDamageByBendingEvent;
|
||||
import com.projectkorra.ProjectKorra.airbending.AirBlast;
|
||||
import com.projectkorra.ProjectKorra.airbending.AirBubble;
|
||||
import com.projectkorra.ProjectKorra.airbending.AirBurst;
|
||||
|
@ -1345,12 +1346,13 @@ public class Methods {
|
|||
return set;
|
||||
}
|
||||
|
||||
public static void damageEntity(Player player, Entity entity, double damage) {
|
||||
public static void damageEntity(Player player, Entity entity, String ability, double damage) {
|
||||
if (entity instanceof LivingEntity) {
|
||||
((LivingEntity) entity).damage(damage, player);
|
||||
((LivingEntity) entity)
|
||||
.setLastDamageCause(new EntityDamageByEntityEvent(player,
|
||||
entity, DamageCause.CUSTOM, damage));
|
||||
Bukkit.getServer().getPluginManager().callEvent(new EntityDamageByBendingEvent(player, entity, ability, damage));
|
||||
// ((LivingEntity) entity).damage(damage, player);
|
||||
// ((LivingEntity) entity)
|
||||
// .setLastDamageCause(new EntityDamageByEntityEvent(player,
|
||||
// entity, DamageCause.CUSTOM, damage));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,9 @@ import java.util.ArrayList;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.EntityEffect;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
|
@ -54,6 +56,7 @@ import org.bukkit.potion.PotionEffectType;
|
|||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.projectkorra.ProjectKorra.Ability.AvatarState;
|
||||
import com.projectkorra.ProjectKorra.CustomEvents.EntityDamageByBendingEvent;
|
||||
import com.projectkorra.ProjectKorra.CustomEvents.PlayerGrappleEvent;
|
||||
import com.projectkorra.ProjectKorra.Utilities.GrapplingHookAPI;
|
||||
import com.projectkorra.ProjectKorra.airbending.AirBlast;
|
||||
|
@ -1010,7 +1013,7 @@ public class PKListener implements Listener {
|
|||
Player source = Flight.getLaunchedBy(player);
|
||||
if (source != null) {
|
||||
event.setCancelled(true);
|
||||
Methods.damageEntity(source, player, event.getDamage());
|
||||
Methods.damageEntity(source, player, null, event.getDamage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1045,6 +1048,32 @@ public class PKListener implements Listener {
|
|||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onEntityDamageByBending(EntityDamageByBendingEvent event) {
|
||||
Player player = event.getAttacker();
|
||||
Entity target = event.getTarget();
|
||||
if (target instanceof LivingEntity) {
|
||||
LivingEntity le = (LivingEntity) target;
|
||||
if (event.isCancelled()) return;
|
||||
if (target instanceof Player) {
|
||||
Player victim = (Player) target;
|
||||
if (event.getAbilityName() != null && event.getAbilityName().equalsIgnoreCase("FireBurst")) {
|
||||
Bukkit.getServer().broadcastMessage("FireBurst: " + event.getDamage());
|
||||
return;
|
||||
}
|
||||
victim.playEffect(EntityEffect.HURT);
|
||||
if (victim.getHealth() - event.getDamage() <= 0) {
|
||||
victim.setHealth(0);
|
||||
} else {
|
||||
victim.setHealth(victim.getHealth() - event.getDamage());
|
||||
}
|
||||
} else {
|
||||
target.playEffect(EntityEffect.HURT);
|
||||
le.damage(event.getDamage(), player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -260,7 +260,8 @@ public class AirSwipe {
|
|||
if (entity instanceof LivingEntity
|
||||
&& !affectedentities.contains(entity)) {
|
||||
if (damage != 0)
|
||||
Methods.damageEntity(player, entity, damage);
|
||||
Methods.damageEntity(player, entity, "AirSwipe", damage);
|
||||
// Methods.damageEntity(player, entity, damage);
|
||||
affectedentities.add(entity);
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ public class RapidPunch {
|
|||
instance.remove(p);
|
||||
if (target instanceof LivingEntity && target != null) {
|
||||
LivingEntity lt = (LivingEntity) target;
|
||||
Methods.damageEntity(p, target, damage);
|
||||
Methods.damageEntity(p, target, "RapidPunch", damage);
|
||||
if (target instanceof Player)
|
||||
if (ChiPassive.willChiBlock((Player) target)) {
|
||||
ChiPassive.blockChi((Player) target);
|
||||
|
|
|
@ -389,7 +389,7 @@ public class EarthBlast {
|
|||
Location location = player.getEyeLocation();
|
||||
Vector vector = location.getDirection();
|
||||
entity.setVelocity(vector.normalize().multiply(pushfactor));
|
||||
Methods.damageEntity(player, entity, damage);
|
||||
Methods.damageEntity(player, entity, "EarthBlast", damage);
|
||||
progressing = false;
|
||||
|
||||
// }
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.projectkorra.ProjectKorra.earthbending;
|
|||
import java.util.ArrayList;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
|
@ -20,7 +21,7 @@ public class Ripple {
|
|||
private static ConcurrentHashMap<Integer[], Block> blocks = new ConcurrentHashMap<Integer[], Block>();
|
||||
|
||||
static final double radius = 15;
|
||||
private static final int damage = 5;
|
||||
private static final double damage = 5;
|
||||
|
||||
private static int ID = Integer.MIN_VALUE;
|
||||
|
||||
|
@ -240,14 +241,13 @@ public class Ripple {
|
|||
length = 2;
|
||||
}
|
||||
if (Methods.moveEarth(player, block, new Vector(0, 1, 0), length, false)) {
|
||||
for (Entity entity : Methods.getEntitiesAroundPoint(block
|
||||
.getLocation().clone().add(0, 1, 0), 2)) {
|
||||
if (entity.getEntityId() != player.getEntityId()
|
||||
&& !entities.contains(entity)) {
|
||||
if (!(entity instanceof FallingBlock))
|
||||
for (Entity entity : Methods.getEntitiesAroundPoint(block.getLocation().clone().add(0, 1, 0), 2)) {
|
||||
if (entity.getEntityId() != player.getEntityId() && !entities.contains(entity)) {
|
||||
if (!(entity instanceof FallingBlock)) {
|
||||
entities.add(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -256,7 +256,7 @@ public class Ripple {
|
|||
private void affect(Entity entity) {
|
||||
|
||||
if (entity instanceof LivingEntity) {
|
||||
Methods.damageEntity(player, entity, damage);
|
||||
Methods.damageEntity(player, entity, "Shockwave", damage);
|
||||
}
|
||||
|
||||
Vector vector = direction.clone();
|
||||
|
|
|
@ -49,7 +49,7 @@ public class FireBlast {
|
|||
private int id;
|
||||
private double speedfactor;
|
||||
private int ticks = 0;
|
||||
private int damage = ProjectKorra.plugin.getConfig().getInt("Abilities.Fire.FireBlast.Damage");
|
||||
private double damage = ProjectKorra.plugin.getConfig().getDouble("Abilities.Fire.FireBlast.Damage");
|
||||
double range = ProjectKorra.plugin.getConfig().getDouble("Abilities.Fire.FireBlast.Range");
|
||||
long cooldown = ProjectKorra.plugin.getConfig().getLong("Abilities.Fire.FireBlast.Cooldown");
|
||||
|
||||
|
@ -95,7 +95,7 @@ public class FireBlast {
|
|||
}
|
||||
|
||||
public FireBlast(Location location, Vector direction, Player player,
|
||||
int damage, List<Block> safeblocks) {
|
||||
double damage, List<Block> safeblocks) {
|
||||
if (location.getBlock().isLiquid()) {
|
||||
return;
|
||||
}
|
||||
|
@ -134,46 +134,9 @@ public class FireBlast {
|
|||
return false;
|
||||
}
|
||||
|
||||
// if (player.isSneaking()
|
||||
// && Methods.getBendingAbility(player) == Abilities.AirBlast) {
|
||||
// new AirBlast(player);
|
||||
// }
|
||||
|
||||
Block block = location.getBlock();
|
||||
// for (Block testblock : Methods.getBlocksAroundPoint(location,
|
||||
// affectingradius)) {
|
||||
// if (testblock.getType() == Material.FIRE) {
|
||||
// testblock.setType(Material.AIR);
|
||||
// testblock.getWorld().playEffect(testblock.getLocation(),
|
||||
// Effect.EXTINGUISH, 0);
|
||||
// }
|
||||
// if (((block.getType() == Material.LEVER) || (block.getType() ==
|
||||
// Material.STONE_BUTTON))
|
||||
// && !affectedlevers.contains(block)) {
|
||||
// EntityHuman eH = ((CraftPlayer) player).getHandle();
|
||||
//
|
||||
// net.minecraft.server.Block.byId[block.getTypeId()].interact(
|
||||
// ((CraftWorld) block.getWorld()).getHandle(),
|
||||
// block.getX(), block.getY(), block.getZ(), eH);
|
||||
//
|
||||
// affectedlevers.add(block);
|
||||
// }
|
||||
// }
|
||||
if (Methods.isSolid(block) || block.isLiquid()) {
|
||||
if (block.getType() == Material.FURNACE && canPowerFurnace) {
|
||||
// BlockState state = block.getState();
|
||||
// Furnace furnace = (Furnace) state;
|
||||
// FurnaceInventory inv = furnace.getInventory();
|
||||
// if (inv.getFuel() == null) {
|
||||
// ItemStack temp = inv.getSmelting();
|
||||
// ItemStack tempfuel = new ItemStack(Material.WOOD_AXE, 1);
|
||||
// ItemStack tempsmelt = new ItemStack(Material.COBBLESTONE);
|
||||
// inv.setFuel(tempfuel);
|
||||
// inv.setSmelting(tempsmelt);
|
||||
// state.update(true);
|
||||
// inv.setSmelting(temp);
|
||||
// state.update(true);
|
||||
// }
|
||||
} else if (FireStream.isIgnitable(player,
|
||||
block.getRelative(BlockFace.UP))) {
|
||||
ignite(location);
|
||||
|
@ -200,17 +163,8 @@ public class FireBlast {
|
|||
|
||||
for (Entity entity : Methods.getEntitiesAroundPoint(location,
|
||||
affectingradius)) {
|
||||
// Block bblock = location.getBlock();
|
||||
// Block block1 = entity.getLocation().getBlock();
|
||||
// if (bblock.equals(block1))
|
||||
affect(entity);
|
||||
if (entity instanceof LivingEntity) {
|
||||
// Block block2 = ((LivingEntity) entity).getEyeLocation()
|
||||
// .getBlock();
|
||||
// if (bblock.equals(block1))
|
||||
// break;
|
||||
// if (bblock.equals(block2)) {
|
||||
// affect(entity);
|
||||
break;
|
||||
// }
|
||||
}
|
||||
|
@ -265,7 +219,7 @@ public class FireBlast {
|
|||
}
|
||||
if (entity instanceof LivingEntity) {
|
||||
entity.setFireTicks(50);
|
||||
Methods.damageEntity(player, entity, (int) Methods
|
||||
Methods.damageEntity(player, entity, "FireBlast", Methods
|
||||
.firebendingDayAugment((double) damage,
|
||||
entity.getWorld()));
|
||||
new Enflamed(entity, player);
|
||||
|
|
|
@ -22,7 +22,7 @@ public class FireBurst {
|
|||
|
||||
private Player player;
|
||||
private long starttime;
|
||||
private int damage = 3;
|
||||
private double damage = 3;
|
||||
private long chargetime = 2500;
|
||||
private double deltheta = 10;
|
||||
private double delphi = 10;
|
||||
|
|
|
@ -155,14 +155,14 @@ public class Fireball {
|
|||
if (distance > explosionradius)
|
||||
return;
|
||||
if (distance < innerradius) {
|
||||
Methods.damageEntity(player, entity, maxdamage);
|
||||
Methods.damageEntity(player, entity, "FireBlast", maxdamage);
|
||||
return;
|
||||
}
|
||||
double slope = -(maxdamage * .5) / (explosionradius - innerradius);
|
||||
|
||||
double damage = slope * (distance - innerradius) + maxdamage;
|
||||
// Methods.verbose(damage);
|
||||
Methods.damageEntity(player, entity, (int) damage);
|
||||
Methods.damageEntity(player, entity, "FireBlast", damage);
|
||||
}
|
||||
|
||||
private void fireball() {
|
||||
|
|
|
@ -153,7 +153,7 @@ public class Lightning {
|
|||
return;
|
||||
double damage = maxdamage - (distance / strikeradius) * .5;
|
||||
hitentities.add(entity);
|
||||
Methods.damageEntity(player, entity, (int) damage);
|
||||
Methods.damageEntity(player, entity, "Lightning", damage);
|
||||
}
|
||||
|
||||
public static boolean isNearbyChannel(Location location) {
|
||||
|
|
|
@ -184,7 +184,7 @@ public class WallOfFire {
|
|||
entity.setFireTicks(50);
|
||||
entity.setVelocity(new Vector(0, 0, 0));
|
||||
if (entity instanceof LivingEntity) {
|
||||
Methods.damageEntity(player, entity, damage);
|
||||
Methods.damageEntity(player, entity, "WallOfFire", damage);
|
||||
new Enflamed(entity, player);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,8 @@ public class Bloodbending {
|
|||
"Bloodbending")))
|
||||
continue;
|
||||
}
|
||||
Methods.damageEntity(player, entity, 0);
|
||||
Methods.damageEntity(player, entity, "Bloodbending", 0);
|
||||
// Methods.damageEntity(player, entity, 0);
|
||||
targetentities.put(entity, entity.getLocation().clone());
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +72,8 @@ public class Bloodbending {
|
|||
|| AvatarState.isAvatarState((Player) target))
|
||||
return;
|
||||
}
|
||||
Methods.damageEntity(player, target, 0);
|
||||
Methods.damageEntity(player, target, "Bloodbending", 0);
|
||||
// Methods.damageEntity(player, target, 0);
|
||||
targetentities.put(target, target.getLocation().clone());
|
||||
}
|
||||
this.player = player;
|
||||
|
@ -138,7 +140,8 @@ public class Bloodbending {
|
|||
entities.add(entity);
|
||||
if (!targetentities.containsKey(entity)
|
||||
&& entity instanceof LivingEntity) {
|
||||
Methods.damageEntity(player, entity, 0);
|
||||
Methods.damageEntity(player, entity, "Bloodbending", 0);
|
||||
// Methods.damageEntity(player, entity, 0);
|
||||
targetentities.put(entity, entity.getLocation().clone());
|
||||
}
|
||||
if (entity instanceof LivingEntity) {
|
||||
|
|
|
@ -141,7 +141,8 @@ public class OctopusForm {
|
|||
.getDirection(player.getLocation(), location).normalize()
|
||||
.multiply(1.75));
|
||||
if (entity instanceof LivingEntity)
|
||||
Methods.damageEntity(player, entity, damage);
|
||||
Methods.damageEntity(player, entity, "OctopusForm", damage);
|
||||
// Methods.damageEntity(player, entity, damage);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -527,7 +527,8 @@ public class Torrent {
|
|||
if (Methods.isNight(world)) {
|
||||
damagedealt = (int) (Methods.getWaterbendingNightAugment(world) * (double) deflectdamage);
|
||||
}
|
||||
Methods.damageEntity(player, entity, damagedealt);
|
||||
Methods.damageEntity(player, entity, "Torrent", damagedealt);
|
||||
// Methods.damageEntity(player, entity, damagedealt);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -546,7 +547,8 @@ public class Torrent {
|
|||
damagedealt = (int) (Methods.getWaterbendingNightAugment(world) * (double) damage);
|
||||
}
|
||||
// if (((LivingEntity) entity).getNoDamageTicks() == 0) {
|
||||
Methods.damageEntity(player, entity, damagedealt);
|
||||
Methods.damageEntity(player, entity, "Torrent", damagedealt);
|
||||
// Methods.damageEntity(player, entity, damagedealt);
|
||||
// Methods.verbose("Hit! Health at "
|
||||
// + ((LivingEntity) entity).getHealth());
|
||||
hurtentities.add(entity);
|
||||
|
|
|
@ -382,9 +382,10 @@ public class WaterManipulation {
|
|||
// .add(direction));
|
||||
if (AvatarState.isAvatarState(player))
|
||||
damage = AvatarState.getValue(damage);
|
||||
Methods.damageEntity(player, entity, (int) Methods
|
||||
.waterbendingNightAugment(damage,
|
||||
player.getWorld()));
|
||||
Methods.damageEntity(player, entity, "WaterManipulation", Methods.waterbendingNightAugment(damage, player.getWorld()));
|
||||
// Methods.damageEntity(player, entity, (int) Methods
|
||||
// .waterbendingNightAugment(damage,
|
||||
// player.getWorld()));
|
||||
progressing = false;
|
||||
// }
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue