Revert "Stupid Commit, Will Revert"

This reverts commit 599ecf6426.
This commit is contained in:
MistPhizzle 2014-07-13 16:41:07 -04:00
parent 676a794ba1
commit 8fd403bcbd
16 changed files with 116 additions and 168 deletions

View file

@ -1,59 +0,0 @@
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;
}
}

View file

@ -65,7 +65,6 @@ 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;
@ -1346,13 +1345,12 @@ public class Methods {
return set;
}
public static void damageEntity(Player player, Entity entity, String ability, double damage) {
public static void damageEntity(Player player, Entity entity, double damage) {
if (entity instanceof LivingEntity) {
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));
((LivingEntity) entity).damage(damage, player);
((LivingEntity) entity)
.setLastDamageCause(new EntityDamageByEntityEvent(player,
entity, DamageCause.CUSTOM, damage));
}
}

View file

@ -4,9 +4,7 @@ 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;
@ -56,7 +54,6 @@ 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;
@ -118,7 +115,7 @@ public class PKListener implements Listener {
public PKListener(ProjectKorra plugin) {
this.plugin = plugin;
}
public static HashMap<Integer, Integer> noFallEntities = new HashMap<Integer, Integer>(); // Grappling Hooks
public static HashMap<String, Integer> noGrapplePlayers = new HashMap<String, Integer>(); // Grappling Hooks
@ -126,7 +123,7 @@ public class PKListener implements Listener {
public void onPlayerGrapple(PlayerGrappleEvent event) {
if (event.isCancelled()) return;
if (!plugin.getConfig().getBoolean("Properties.CustomItems.GrapplingHook.Enable")) return;
Player player = event.getPlayer();
if (!Methods.isBender(player.getName(), Element.Chi) && (!Methods.isBender(player.getName(), Element.Earth) || !Methods.canMetalbend(player))) {
event.setCancelled(true);
@ -135,29 +132,29 @@ public class PKListener implements Listener {
if (Paralyze.isParalyzed(player) || Bloodbending.isBloodbended(player)) {
event.setCancelled(true);
}
event.getHookItem().setDurability((short) - 10);
if (noGrapplePlayers.containsKey(player.getName())) {
return;
}
Entity e = event.getPulledEntity();
Location loc = event.getPullLocation();
if (player.equals(e)) {
if (player.getLocation().distance(loc) < 3) { // Too close
GrapplingHookAPI.pullPlayerSlightly(player, loc);
} else {
GrapplingHookAPI.pullEntityToLocation(player, loc);
}
if (GrapplingHookAPI.addUse(player, event.getHookItem())) {
GrapplingHookAPI.playGrappleSound(player.getLocation());
}
GrapplingHookAPI.addPlayerCooldown(player, 100);
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void fishEvent(PlayerFishEvent event) {
Player player = event.getPlayer();
@ -171,7 +168,7 @@ public class PKListener implements Listener {
return;
}
}
PlayerGrappleEvent e = new PlayerGrappleEvent(player, player, loc);
plugin.getServer().getPluginManager().callEvent(e);
}
@ -278,7 +275,7 @@ public class PKListener implements Listener {
if (abil == null) {
return;
}
if (Methods.isChiBlocked(player.getName())) {
event.setCancelled(true);
return;
@ -364,7 +361,7 @@ public class PKListener implements Listener {
if (abil.equalsIgnoreCase("Tremorsense")) {
Methods.getBendingPlayer(player.getName()).toggleTremorsense();
}
if (abil.equalsIgnoreCase("Extraction")) {
new Extraction(player);
}
@ -560,7 +557,7 @@ public class PKListener implements Listener {
event.setCancelled(true);
return;
}
if (Methods.isChiBlocked(player.getName())) {
event.setCancelled(true);
return;
@ -569,8 +566,8 @@ public class PKListener implements Listener {
String abil = Methods.getBoundAbility(player);
if (abil == null) return;
if (Methods.canBend(player.getName(), abil)) {
if (Methods.isAirAbility(abil)) {
if (Methods.isWeapon(player.getItemInHand().getType()) && !plugin.getConfig().getBoolean("Properties.Air.CanBendWithWeapons")) {
return;
@ -703,7 +700,7 @@ public class PKListener implements Listener {
//
}
}
if (abil.equalsIgnoreCase("AvatarState")) {
new AvatarState(player);
}
@ -902,7 +899,7 @@ public class PKListener implements Listener {
Entity en = e.getEntity();
if (en instanceof Player) {
// Player p = (Player) en; // This is the player getting hurt.
// Player p = (Player) en; // This is the player getting hurt.
if (e.getDamager() instanceof Player) { // This is the player hitting someone.
Player sourceplayer = (Player) e.getDamager();
Player targetplayer = (Player) e.getEntity();
@ -932,28 +929,28 @@ public class PKListener implements Listener {
}
}
}
// Player damager = (Player) e.getDamager();
// if (Methods.canBendPassive(damager.getName(), Element.Chi)) {
// if (e.getCause() == DamageCause.ENTITY_ATTACK) {
// if (Methods.isWeapon(damager.getItemInHand().getType()) && !ProjectKorra.plugin.getConfig().getBoolean("Properties.Chi.CanBendWithWeapons")) {
// return;
// }
// if (damager.getItemInHand() != null && Methods.isWeapon(damager.getItemInHand().getType()) && !ProjectKorra.plugin.getConfig().getBoolean("Properties.Chi.CanBendWithWeapons")) {
// // Above method checks if the player has an item in their hand, if it is a weapon, and if they can bend with weapons.
// if (Methods.getBoundAbility(damager) == null || Methods.getBoundAbility(damager).equalsIgnoreCase("RapidPunch")) { // We don't want them to be able to block chi if an ability is bound.
// if (ChiPassive.willChiBlock(p)) {
// ChiPassive.blockChi(p);
// }
// }
// if (Methods.getBoundAbility(damager).equalsIgnoreCase("Paralyze")) {
// if (ChiPassive.willChiBlock(p)) {
// new Paralyze((Player) e.getDamager(), e.getEntity());
// }
// }
// }
// }
// }
// Player damager = (Player) e.getDamager();
// if (Methods.canBendPassive(damager.getName(), Element.Chi)) {
// if (e.getCause() == DamageCause.ENTITY_ATTACK) {
// if (Methods.isWeapon(damager.getItemInHand().getType()) && !ProjectKorra.plugin.getConfig().getBoolean("Properties.Chi.CanBendWithWeapons")) {
// return;
// }
// if (damager.getItemInHand() != null && Methods.isWeapon(damager.getItemInHand().getType()) && !ProjectKorra.plugin.getConfig().getBoolean("Properties.Chi.CanBendWithWeapons")) {
// // Above method checks if the player has an item in their hand, if it is a weapon, and if they can bend with weapons.
// if (Methods.getBoundAbility(damager) == null || Methods.getBoundAbility(damager).equalsIgnoreCase("RapidPunch")) { // We don't want them to be able to block chi if an ability is bound.
// if (ChiPassive.willChiBlock(p)) {
// ChiPassive.blockChi(p);
// }
// }
// if (Methods.getBoundAbility(damager).equalsIgnoreCase("Paralyze")) {
// if (ChiPassive.willChiBlock(p)) {
// new Paralyze((Player) e.getDamager(), e.getEntity());
// }
// }
// }
// }
// }
}
}
}
@ -1013,7 +1010,7 @@ public class PKListener implements Listener {
Player source = Flight.getLaunchedBy(player);
if (source != null) {
event.setCancelled(true);
Methods.damageEntity(source, player, null, event.getDamage());
Methods.damageEntity(source, player, event.getDamage());
}
}
@ -1048,32 +1045,6 @@ 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);
}
}
}
}

View file

@ -260,8 +260,7 @@ public class AirSwipe {
if (entity instanceof LivingEntity
&& !affectedentities.contains(entity)) {
if (damage != 0)
Methods.damageEntity(player, entity, "AirSwipe", damage);
// Methods.damageEntity(player, entity, damage);
Methods.damageEntity(player, entity, damage);
affectedentities.add(entity);
}

View file

@ -53,7 +53,7 @@ public class RapidPunch {
instance.remove(p);
if (target instanceof LivingEntity && target != null) {
LivingEntity lt = (LivingEntity) target;
Methods.damageEntity(p, target, "RapidPunch", damage);
Methods.damageEntity(p, target, damage);
if (target instanceof Player)
if (ChiPassive.willChiBlock((Player) target)) {
ChiPassive.blockChi((Player) target);

View file

@ -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, "EarthBlast", damage);
Methods.damageEntity(player, entity, damage);
progressing = false;
// }

View file

@ -3,7 +3,6 @@ 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;
@ -21,7 +20,7 @@ public class Ripple {
private static ConcurrentHashMap<Integer[], Block> blocks = new ConcurrentHashMap<Integer[], Block>();
static final double radius = 15;
private static final double damage = 5;
private static final int damage = 5;
private static int ID = Integer.MIN_VALUE;
@ -241,11 +240,12 @@ 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;
@ -256,7 +256,7 @@ public class Ripple {
private void affect(Entity entity) {
if (entity instanceof LivingEntity) {
Methods.damageEntity(player, entity, "Shockwave", damage);
Methods.damageEntity(player, entity, damage);
}
Vector vector = direction.clone();

View file

@ -49,7 +49,7 @@ public class FireBlast {
private int id;
private double speedfactor;
private int ticks = 0;
private double damage = ProjectKorra.plugin.getConfig().getDouble("Abilities.Fire.FireBlast.Damage");
private int damage = ProjectKorra.plugin.getConfig().getInt("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,
double damage, List<Block> safeblocks) {
int damage, List<Block> safeblocks) {
if (location.getBlock().isLiquid()) {
return;
}
@ -134,9 +134,46 @@ 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);
@ -163,8 +200,17 @@ 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;
// }
}
@ -219,7 +265,7 @@ public class FireBlast {
}
if (entity instanceof LivingEntity) {
entity.setFireTicks(50);
Methods.damageEntity(player, entity, "FireBlast", Methods
Methods.damageEntity(player, entity, (int) Methods
.firebendingDayAugment((double) damage,
entity.getWorld()));
new Enflamed(entity, player);

View file

@ -22,7 +22,7 @@ public class FireBurst {
private Player player;
private long starttime;
private double damage = 3;
private int damage = 3;
private long chargetime = 2500;
private double deltheta = 10;
private double delphi = 10;

View file

@ -155,14 +155,14 @@ public class Fireball {
if (distance > explosionradius)
return;
if (distance < innerradius) {
Methods.damageEntity(player, entity, "FireBlast", maxdamage);
Methods.damageEntity(player, entity, maxdamage);
return;
}
double slope = -(maxdamage * .5) / (explosionradius - innerradius);
double damage = slope * (distance - innerradius) + maxdamage;
// Methods.verbose(damage);
Methods.damageEntity(player, entity, "FireBlast", damage);
Methods.damageEntity(player, entity, (int) damage);
}
private void fireball() {

View file

@ -153,7 +153,7 @@ public class Lightning {
return;
double damage = maxdamage - (distance / strikeradius) * .5;
hitentities.add(entity);
Methods.damageEntity(player, entity, "Lightning", damage);
Methods.damageEntity(player, entity, (int) damage);
}
public static boolean isNearbyChannel(Location location) {

View file

@ -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, "WallOfFire", damage);
Methods.damageEntity(player, entity, damage);
new Enflamed(entity, player);
}
}

View file

@ -54,8 +54,7 @@ public class Bloodbending {
"Bloodbending")))
continue;
}
Methods.damageEntity(player, entity, "Bloodbending", 0);
// Methods.damageEntity(player, entity, 0);
Methods.damageEntity(player, entity, 0);
targetentities.put(entity, entity.getLocation().clone());
}
}
@ -72,8 +71,7 @@ public class Bloodbending {
|| AvatarState.isAvatarState((Player) target))
return;
}
Methods.damageEntity(player, target, "Bloodbending", 0);
// Methods.damageEntity(player, target, 0);
Methods.damageEntity(player, target, 0);
targetentities.put(target, target.getLocation().clone());
}
this.player = player;
@ -140,8 +138,7 @@ public class Bloodbending {
entities.add(entity);
if (!targetentities.containsKey(entity)
&& entity instanceof LivingEntity) {
Methods.damageEntity(player, entity, "Bloodbending", 0);
// Methods.damageEntity(player, entity, 0);
Methods.damageEntity(player, entity, 0);
targetentities.put(entity, entity.getLocation().clone());
}
if (entity instanceof LivingEntity) {

View file

@ -141,8 +141,7 @@ public class OctopusForm {
.getDirection(player.getLocation(), location).normalize()
.multiply(1.75));
if (entity instanceof LivingEntity)
Methods.damageEntity(player, entity, "OctopusForm", damage);
// Methods.damageEntity(player, entity, damage);
Methods.damageEntity(player, entity, damage);
}
}

View file

@ -527,8 +527,7 @@ public class Torrent {
if (Methods.isNight(world)) {
damagedealt = (int) (Methods.getWaterbendingNightAugment(world) * (double) deflectdamage);
}
Methods.damageEntity(player, entity, "Torrent", damagedealt);
// Methods.damageEntity(player, entity, damagedealt);
Methods.damageEntity(player, entity, damagedealt);
}
}
@ -547,8 +546,7 @@ public class Torrent {
damagedealt = (int) (Methods.getWaterbendingNightAugment(world) * (double) damage);
}
// if (((LivingEntity) entity).getNoDamageTicks() == 0) {
Methods.damageEntity(player, entity, "Torrent", damagedealt);
// Methods.damageEntity(player, entity, damagedealt);
Methods.damageEntity(player, entity, damagedealt);
// Methods.verbose("Hit! Health at "
// + ((LivingEntity) entity).getHealth());
hurtentities.add(entity);

View file

@ -382,10 +382,9 @@ public class WaterManipulation {
// .add(direction));
if (AvatarState.isAvatarState(player))
damage = AvatarState.getValue(damage);
Methods.damageEntity(player, entity, "WaterManipulation", Methods.waterbendingNightAugment(damage, player.getWorld()));
// Methods.damageEntity(player, entity, (int) Methods
// .waterbendingNightAugment(damage,
// player.getWorld()));
Methods.damageEntity(player, entity, (int) Methods
.waterbendingNightAugment(damage,
player.getWorld()));
progressing = false;
// }
}