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

5
.gitignore vendored
View file

@ -39,8 +39,3 @@ Icon
bin/ bin/
*.classpath *.classpath
.idea/.name
*.xml
*.class
*.class
ProjectKorra.iml

View file

@ -65,7 +65,6 @@ public class ConfigManager {
config.addDefault("Properties.BendingAffectFallingSand.TNTStrengthMultiplier", 1.0); config.addDefault("Properties.BendingAffectFallingSand.TNTStrengthMultiplier", 1.0);
config.addDefault("Properties.GlobalCooldown", 500); config.addDefault("Properties.GlobalCooldown", 500);
config.addDefault("Properties.SeaLevel", 62); config.addDefault("Properties.SeaLevel", 62);
config.addDefault("Properties.HorizontalCollisionPhysics.WallDamageMinimumDistance", 5.0);
config.addDefault("Properties.CustomItems.GrapplingHook.Enable", true); config.addDefault("Properties.CustomItems.GrapplingHook.Enable", true);
config.addDefault("Properties.CustomItems.GrapplingHook.IronUses", 25); 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.Methods;
import com.projectkorra.ProjectKorra.ProjectKorra; import com.projectkorra.ProjectKorra.ProjectKorra;
import com.projectkorra.ProjectKorra.Utilities.HorizontalVelocityChangeEvent; import com.projectkorra.ProjectKorra.Utilities.HorizontalVelocityChangeEvent;
import org.bukkit.Location;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -25,8 +24,6 @@ public class HorizontalVelocityTracker
private Player instigator; private Player instigator;
private Vector lastVelocity; private Vector lastVelocity;
private Vector thisVelocity; private Vector thisVelocity;
private Location launchLocation;
private Location impactLocation;
public HorizontalVelocityTracker(Entity e, Player instigator, long delay) public HorizontalVelocityTracker(Entity e, Player instigator, long delay)
{ {
@ -34,9 +31,7 @@ public class HorizontalVelocityTracker
this.instigator = instigator; this.instigator = instigator;
fireTime = System.currentTimeMillis(); fireTime = System.currentTimeMillis();
this.delay = delay; this.delay = delay;
thisVelocity = e.getVelocity().clone(); thisVelocity = e.getVelocity();
launchLocation = e.getLocation().clone();
impactLocation = launchLocation.clone();
this.delay = delay; this.delay = delay;
update(); update();
instances.put(entity, this); instances.put(entity, this);
@ -74,12 +69,11 @@ public class HorizontalVelocityTracker
if((diff.getX() > 1 || diff.getX() < -1) if((diff.getX() > 1 || diff.getX() < -1)
|| (diff.getZ() > 1 || diff.getZ() < -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(); remove();
return; return;
} }

View file

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

View file

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