mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-11 03:30:10 +00:00
Fixed some errors with wall damage.
This commit is contained in:
parent
bc135c6f12
commit
2ff4484394
3 changed files with 9 additions and 8 deletions
|
@ -3,9 +3,9 @@ package com.projectkorra.ProjectKorra.Objects;
|
|||
import com.projectkorra.ProjectKorra.Methods;
|
||||
import com.projectkorra.ProjectKorra.ProjectKorra;
|
||||
import com.projectkorra.ProjectKorra.Utilities.HorizontalVelocityChangeEvent;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
@ -20,11 +20,11 @@ public class HorizontalVelocityTracker
|
|||
private long delay;
|
||||
private long fireTime;
|
||||
private Entity entity;
|
||||
private Entity instigator;
|
||||
private Player instigator;
|
||||
private Vector lastVelocity;
|
||||
private Vector thisVelocity;
|
||||
|
||||
public HorizontalVelocityTracker(Entity e, Entity instigator, long delay)
|
||||
public HorizontalVelocityTracker(Entity e, Player instigator, long delay)
|
||||
{
|
||||
entity = e;
|
||||
this.instigator = instigator;
|
||||
|
@ -56,7 +56,7 @@ public class HorizontalVelocityTracker
|
|||
{
|
||||
for(Block b : Methods.getBlocksAroundPoint(entity.getLocation(), 2))
|
||||
{
|
||||
if(b.getType() != Material.AIR)
|
||||
if(!Methods.isTransparentToEarthbending(instigator, b))
|
||||
{
|
||||
ProjectKorra.plugin.getServer().getPluginManager().callEvent(new HorizontalVelocityChangeEvent(entity, instigator, lastVelocity, thisVelocity, diff));
|
||||
remove();
|
||||
|
|
|
@ -70,7 +70,7 @@ public class PKListener implements Listener {
|
|||
|
||||
if(e.getEntity() instanceof LivingEntity)
|
||||
{
|
||||
((LivingEntity) e.getEntity()).damage(e.getDifference().length() * 2, e.getInstigator());
|
||||
Methods.damageEntity(e.getInstigator(), e.getEntity(), e.getDifference().length() * 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.projectkorra.ProjectKorra.Utilities;
|
||||
|
||||
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;
|
||||
|
@ -16,12 +17,12 @@ public class HorizontalVelocityChangeEvent extends Event implements Cancellable
|
|||
private boolean isCancelled;
|
||||
|
||||
private Entity entity;
|
||||
private Entity instigator;
|
||||
private Player instigator;
|
||||
private Vector from;
|
||||
private Vector to;
|
||||
private Vector difference;
|
||||
|
||||
public HorizontalVelocityChangeEvent(Entity entity, Entity instigator, Vector from, Vector to, Vector difference)
|
||||
public HorizontalVelocityChangeEvent(Entity entity, Player instigator, Vector from, Vector to, Vector difference)
|
||||
{
|
||||
this.entity = entity;
|
||||
this.instigator = instigator;
|
||||
|
@ -35,7 +36,7 @@ public class HorizontalVelocityChangeEvent extends Event implements Cancellable
|
|||
return entity;
|
||||
}
|
||||
|
||||
public Entity getInstigator()
|
||||
public Player getInstigator()
|
||||
{
|
||||
return instigator;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue