mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-12 03:59:06 +00:00
Merge pull request #301 from Simplicitee/master
Fix display command console, Change horizontal velocity for addons
This commit is contained in:
commit
e1bbc6ea7f
7 changed files with 51 additions and 30 deletions
|
@ -622,9 +622,9 @@ public class PKListener implements Listener {
|
|||
double damage = ((e.getDistanceTraveled() - minimumDistance) < 0 ? 0 : e.getDistanceTraveled() - minimumDistance) / (e.getDifference().length());
|
||||
if (damage > 0) {
|
||||
if(damage <= maxDamage) {
|
||||
GeneralMethods.damageEntity(e.getInstigator(), e.getEntity(), damage, e.getAbility().toString());
|
||||
GeneralMethods.damageEntity(e.getInstigator(), e.getEntity(), damage, e.getElement(), e.getSubElement(), e.getAbility());
|
||||
} else {
|
||||
GeneralMethods.damageEntity(e.getInstigator(), e.getEntity(), maxDamage, e.getAbility().toString());
|
||||
GeneralMethods.damageEntity(e.getInstigator(), e.getEntity(), maxDamage, e.getElement(), e.getSubElement(), e.getAbility());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
package com.projectkorra.projectkorra.airbending;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import com.projectkorra.projectkorra.BendingPlayer;
|
||||
import com.projectkorra.projectkorra.Element;
|
||||
import com.projectkorra.projectkorra.GeneralMethods;
|
||||
import com.projectkorra.projectkorra.ProjectKorra;
|
||||
import com.projectkorra.projectkorra.ability.AvatarState;
|
||||
import com.projectkorra.projectkorra.command.Commands;
|
||||
import com.projectkorra.projectkorra.configuration.ConfigLoadable;
|
||||
import com.projectkorra.projectkorra.object.HorizontalVelocityTracker;
|
||||
import com.projectkorra.projectkorra.util.Flight;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
|
@ -19,15 +25,9 @@ import org.bukkit.material.Lever;
|
|||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.projectkorra.projectkorra.BendingPlayer;
|
||||
import com.projectkorra.projectkorra.GeneralMethods;
|
||||
import com.projectkorra.projectkorra.ProjectKorra;
|
||||
import com.projectkorra.projectkorra.ability.AvatarState;
|
||||
import com.projectkorra.projectkorra.ability.StockAbility;
|
||||
import com.projectkorra.projectkorra.command.Commands;
|
||||
import com.projectkorra.projectkorra.configuration.ConfigLoadable;
|
||||
import com.projectkorra.projectkorra.object.HorizontalVelocityTracker;
|
||||
import com.projectkorra.projectkorra.util.Flight;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class AirBlast implements ConfigLoadable {
|
||||
|
||||
|
@ -237,9 +237,9 @@ public class AirBlast implements ConfigLoadable {
|
|||
|
||||
GeneralMethods.setVelocity(entity, velocity);
|
||||
if (source != null)
|
||||
new HorizontalVelocityTracker(entity, player, 200l, StockAbility.AirBurst);
|
||||
new HorizontalVelocityTracker(entity, player, 200l, "AirBurst", Element.Air, null);
|
||||
else
|
||||
new HorizontalVelocityTracker(entity, player, 200l, StockAbility.AirBlast);
|
||||
new HorizontalVelocityTracker(entity, player, 200l, "AirBlast", Element.Air, null);
|
||||
entity.setFallDistance(0);
|
||||
if (!isUser && entity instanceof Player) {
|
||||
new Flight((Player) entity, player);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package com.projectkorra.projectkorra.airbending;
|
||||
|
||||
import com.projectkorra.projectkorra.BendingPlayer;
|
||||
import com.projectkorra.projectkorra.Element;
|
||||
import com.projectkorra.projectkorra.GeneralMethods;
|
||||
import com.projectkorra.projectkorra.ProjectKorra;
|
||||
import com.projectkorra.projectkorra.ability.AvatarState;
|
||||
import com.projectkorra.projectkorra.ability.StockAbility;
|
||||
import com.projectkorra.projectkorra.command.Commands;
|
||||
import com.projectkorra.projectkorra.configuration.ConfigLoadable;
|
||||
import com.projectkorra.projectkorra.earthbending.EarthMethods;
|
||||
|
@ -261,7 +261,7 @@ public class AirSuction implements ConfigLoadable {
|
|||
continue;
|
||||
}
|
||||
GeneralMethods.setVelocity(entity, velocity);
|
||||
new HorizontalVelocityTracker(entity, player, 200l, StockAbility.AirSuction);
|
||||
new HorizontalVelocityTracker(entity, player, 200l, "AirSuction", Element.Air, null);
|
||||
entity.setFallDistance(0);
|
||||
if (entity.getEntityId() != player.getEntityId() && entity instanceof Player) {
|
||||
new Flight((Player) entity, player);
|
||||
|
|
|
@ -112,9 +112,13 @@ public class DisplayCommand extends PKCommand {
|
|||
return;
|
||||
}
|
||||
for (String ability : abilities) {
|
||||
if (sender instanceof Player) {
|
||||
if (GeneralMethods.canView((Player) sender, ability)) {
|
||||
sender.sendMessage(GeneralMethods.getAvatarColor() + ability);
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(GeneralMethods.getAvatarColor() + ability);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.projectkorra.projectkorra.event;
|
||||
|
||||
import com.projectkorra.projectkorra.ability.StockAbility;
|
||||
import com.projectkorra.projectkorra.Element;
|
||||
import com.projectkorra.projectkorra.SubElement;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
@ -26,7 +27,9 @@ public class HorizontalVelocityChangeEvent extends Event implements Cancellable
|
|||
private Vector difference;
|
||||
private Location start;
|
||||
private Location end;
|
||||
private StockAbility abil;
|
||||
private String abil;
|
||||
private Element element;
|
||||
private SubElement sub;
|
||||
|
||||
@Deprecated
|
||||
public HorizontalVelocityChangeEvent(Entity entity, Player instigator, Vector from, Vector to, Vector difference) {
|
||||
|
@ -37,7 +40,7 @@ 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, StockAbility ability ) {
|
||||
public HorizontalVelocityChangeEvent(Entity entity, Player instigator, Vector from, Vector to, Vector difference, Location start, Location end, String ability, Element element, SubElement sub) {
|
||||
this.entity = entity;
|
||||
this.instigator = instigator;
|
||||
this.from = from;
|
||||
|
@ -80,10 +83,18 @@ public class HorizontalVelocityChangeEvent extends Event implements Cancellable
|
|||
return difference;
|
||||
}
|
||||
|
||||
public StockAbility getAbility() {
|
||||
public String getAbility() {
|
||||
return abil;
|
||||
}
|
||||
|
||||
public Element getElement() {
|
||||
return element;
|
||||
}
|
||||
|
||||
public SubElement getSubElement() {
|
||||
return sub;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package com.projectkorra.projectkorra.object;
|
||||
|
||||
import com.projectkorra.projectkorra.Element;
|
||||
import com.projectkorra.projectkorra.GeneralMethods;
|
||||
import com.projectkorra.projectkorra.ProjectKorra;
|
||||
import com.projectkorra.projectkorra.ability.StockAbility;
|
||||
import com.projectkorra.projectkorra.SubElement;
|
||||
import com.projectkorra.projectkorra.earthbending.EarthMethods;
|
||||
import com.projectkorra.projectkorra.event.HorizontalVelocityChangeEvent;
|
||||
import com.projectkorra.projectkorra.waterbending.WaterMethods;
|
||||
|
@ -32,11 +33,13 @@ public class HorizontalVelocityTracker {
|
|||
private Vector thisVelocity;
|
||||
private Location launchLocation;
|
||||
private Location impactLocation;
|
||||
private StockAbility abil;
|
||||
private String abil;
|
||||
private Element e;
|
||||
private SubElement sub;
|
||||
|
||||
public static String[] abils = {"AirBlast", "AirBurst", "AirSuction", "Bloodbending"};
|
||||
|
||||
public HorizontalVelocityTracker(Entity e, Player instigator, long delay, StockAbility ability) {
|
||||
public HorizontalVelocityTracker(Entity e, Player instigator, long delay, String ability, Element element, SubElement se) {
|
||||
remove(e);
|
||||
entity = e;
|
||||
this.instigator = instigator;
|
||||
|
@ -47,6 +50,8 @@ public class HorizontalVelocityTracker {
|
|||
impactLocation = launchLocation.clone();
|
||||
this.delay = delay;
|
||||
abil = ability;
|
||||
this.e = element;
|
||||
sub = se;
|
||||
update();
|
||||
instances.put(entity, this);
|
||||
}
|
||||
|
@ -77,7 +82,7 @@ public class HorizontalVelocityTracker {
|
|||
if (GeneralMethods.isSolid(b) && (entity.getLocation().getBlock().getRelative(BlockFace.EAST, 1).equals(b) || entity.getLocation().getBlock().getRelative(BlockFace.NORTH, 1).equals(b) || entity.getLocation().getBlock().getRelative(BlockFace.WEST, 1).equals(b) || entity.getLocation().getBlock().getRelative(BlockFace.SOUTH, 1).equals(b))) {
|
||||
if (!EarthMethods.isTransparentToEarthbending(instigator, b)) {
|
||||
hasBeenDamaged = true;
|
||||
ProjectKorra.plugin.getServer().getPluginManager().callEvent(new HorizontalVelocityChangeEvent(entity, instigator, lastVelocity, thisVelocity, diff, launchLocation, impactLocation, abil));
|
||||
ProjectKorra.plugin.getServer().getPluginManager().callEvent(new HorizontalVelocityChangeEvent(entity, instigator, lastVelocity, thisVelocity, diff, launchLocation, impactLocation, abil, e, sub));
|
||||
remove();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package com.projectkorra.projectkorra.waterbending;
|
||||
|
||||
import com.projectkorra.projectkorra.BendingPlayer;
|
||||
import com.projectkorra.projectkorra.Element;
|
||||
import com.projectkorra.projectkorra.GeneralMethods;
|
||||
import com.projectkorra.projectkorra.ProjectKorra;
|
||||
import com.projectkorra.projectkorra.SubElement;
|
||||
import com.projectkorra.projectkorra.ability.AvatarState;
|
||||
import com.projectkorra.projectkorra.ability.StockAbility;
|
||||
import com.projectkorra.projectkorra.airbending.AirMethods;
|
||||
import com.projectkorra.projectkorra.firebending.FireMethods;
|
||||
import com.projectkorra.projectkorra.object.HorizontalVelocityTracker;
|
||||
|
@ -118,7 +119,7 @@ public class Bloodbending {
|
|||
Vector vector = GeneralMethods.getDirection(location, GeneralMethods.getTargetedLocation(player, location.distance(target)));
|
||||
vector.normalize();
|
||||
entity.setVelocity(vector.multiply(factor));
|
||||
new HorizontalVelocityTracker(entity, player, 200, StockAbility.Bloodbending);
|
||||
new HorizontalVelocityTracker(entity, player, 200, "Bloodbending", Element.Air, SubElement.Bloodbending);
|
||||
}
|
||||
remove(player);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue