Revert "Modified the HorizontalCollision damage calculation."

This reverts commit 675200ccd1.
This commit is contained in:
Brendan Wilson 2015-02-05 17:38:41 -05:00
parent 675200ccd1
commit 31cbac3666
5 changed files with 10 additions and 51 deletions

7
.gitignore vendored
View file

@ -38,9 +38,4 @@ Icon
.Trashes
bin/
*.classpath
.idea/.name
*.xml
*.class
*.class
ProjectKorra.iml
*.classpath

View file

@ -65,7 +65,6 @@ public class ConfigManager {
config.addDefault("Properties.BendingAffectFallingSand.TNTStrengthMultiplier", 1.0);
config.addDefault("Properties.GlobalCooldown", 500);
config.addDefault("Properties.SeaLevel", 62);
config.addDefault("Properties.HorizontalCollisionPhysics.WallDamageMinimumDistance", 5.0);
config.addDefault("Properties.CustomItems.GrapplingHook.Enable", true);
config.addDefault("Properties.CustomItems.GrapplingHook.IronUses", 25);

View file

@ -3,7 +3,6 @@ package com.projectkorra.ProjectKorra.Objects;
import com.projectkorra.ProjectKorra.Methods;
import com.projectkorra.ProjectKorra.ProjectKorra;
import com.projectkorra.ProjectKorra.Utilities.HorizontalVelocityChangeEvent;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
@ -25,8 +24,6 @@ public class HorizontalVelocityTracker
private Player instigator;
private Vector lastVelocity;
private Vector thisVelocity;
private Location launchLocation;
private Location impactLocation;
public HorizontalVelocityTracker(Entity e, Player instigator, long delay)
{
@ -34,9 +31,7 @@ public class HorizontalVelocityTracker
this.instigator = instigator;
fireTime = System.currentTimeMillis();
this.delay = delay;
thisVelocity = e.getVelocity().clone();
launchLocation = e.getLocation().clone();
impactLocation = launchLocation.clone();
thisVelocity = e.getVelocity();
this.delay = delay;
update();
instances.put(entity, this);
@ -74,12 +69,11 @@ public class HorizontalVelocityTracker
if((diff.getX() > 1 || diff.getX() < -1)
|| (diff.getZ() > 1 || diff.getZ() < -1))
{
impactLocation = entity.getLocation();
for (Block b : blocks)
for(Block b : blocks)
{
if (!Methods.isTransparentToEarthbending(instigator, b))
if(!Methods.isTransparentToEarthbending(instigator, b))
{
ProjectKorra.plugin.getServer().getPluginManager().callEvent(new HorizontalVelocityChangeEvent(entity, instigator, lastVelocity, thisVelocity, diff, launchLocation, impactLocation));
ProjectKorra.plugin.getServer().getPluginManager().callEvent(new HorizontalVelocityChangeEvent(entity, instigator, lastVelocity, thisVelocity, diff));
remove();
return;
}

View file

@ -13,7 +13,10 @@ import com.projectkorra.ProjectKorra.earthbending.LavaFlow.AbilityType;
import com.projectkorra.ProjectKorra.firebending.*;
import com.projectkorra.ProjectKorra.firebending.Fireball;
import com.projectkorra.ProjectKorra.waterbending.*;
import org.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.*;
import org.bukkit.event.EventHandler;
@ -68,9 +71,7 @@ public class PKListener implements Listener {
{
if(e.getEntity().getEntityId() != e.getInstigator().getEntityId())
{
double minimumDistance = plugin.getConfig().getDouble("Properties.HorizontalCollisionPhysics.WallDamageMinimumDistance");
double damage = ((e.getDistanceTravelled() - minimumDistance) < 0 ? 0 : e.getDistanceTravelled() - minimumDistance) / (e.getDifference().length());
Methods.damageEntity(e.getInstigator(), e.getEntity(), damage);
Methods.damageEntity(e.getInstigator(), e.getEntity(), e.getDifference().length() * 2);
}
}
}

View file

@ -1,6 +1,5 @@
package com.projectkorra.ProjectKorra.Utilities;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
@ -22,10 +21,7 @@ public class HorizontalVelocityChangeEvent extends Event implements Cancellable
private Vector from;
private Vector to;
private Vector difference;
private Location start;
private Location end;
@Deprecated
public HorizontalVelocityChangeEvent(Entity entity, Player instigator, Vector from, Vector to, Vector difference)
{
this.entity = entity;
@ -35,17 +31,6 @@ 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)
{
this.entity = entity;
this.instigator = instigator;
this.from = from;
this.to = to;
this.difference = difference;
this.start = start;
this.end = end;
}
public Entity getEntity()
{
return entity;
@ -66,21 +51,6 @@ public class HorizontalVelocityChangeEvent extends Event implements Cancellable
return to;
}
public Location getStartPoint()
{
return start;
}
public Location getEndPoint()
{
return end;
}
public double getDistanceTravelled()
{
return start.distance(end);
}
public Vector getDifference()
{
return difference;