Fixes Clear arguments
Fixes Velocity Damage
This commit is contained in:
OmniCypher 2015-11-07 18:20:26 -08:00
parent 74e4f1bcb6
commit 33e63d1bc3
2 changed files with 5 additions and 4 deletions

View file

@ -4,6 +4,7 @@ import com.projectkorra.projectkorra.BendingPlayer;
import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.multiability.MultiAbilityManager; import com.projectkorra.projectkorra.ability.multiability.MultiAbilityManager;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -21,7 +22,7 @@ public class ClearCommand extends PKCommand {
@Override @Override
public void execute(CommandSender sender, List<String> args) { public void execute(CommandSender sender, List<String> args) {
if (!hasPermission(sender) || !correctLength(sender, args.size(), 0, 0) || !isPlayer(sender)) { if (!hasPermission(sender) || !correctLength(sender, args.size(), 0, 1) || !isPlayer(sender)) {
return; return;
} else if (MultiAbilityManager.hasMultiAbilityBound((Player) sender)) { } else if (MultiAbilityManager.hasMultiAbilityBound((Player) sender)) {
sender.sendMessage(ChatColor.RED + "You can't edit your binds right now!"); sender.sendMessage(ChatColor.RED + "You can't edit your binds right now!");

View file

@ -46,8 +46,9 @@ public class HorizontalVelocityTracker {
} }
public void update() { public void update() {
if (System.currentTimeMillis() < fireTime + delay) if (System.currentTimeMillis() < fireTime + delay) {
return; return;
}
lastVelocity = thisVelocity.clone(); lastVelocity = thisVelocity.clone();
thisVelocity = entity.getVelocity().clone(); thisVelocity = entity.getVelocity().clone();
@ -67,12 +68,11 @@ public class HorizontalVelocityTracker {
return; return;
} }
} }
if (thisVelocity.length() < lastVelocity.length()) { if (thisVelocity.length() < lastVelocity.length()) {
if ((diff.getX() > 1 || diff.getX() < -1) || (diff.getZ() > 1 || diff.getZ() < -1)) { if ((diff.getX() > 1 || diff.getX() < -1) || (diff.getZ() > 1 || diff.getZ() < -1)) {
impactLocation = entity.getLocation(); impactLocation = entity.getLocation();
for (Block b : blocks) { for (Block b : blocks) {
if (GeneralMethods.isSolid(b) && (entity.getLocation().getBlock().getRelative(BlockFace.EAST) == b || entity.getLocation().getBlock().getRelative(BlockFace.NORTH) == b || entity.getLocation().getBlock().getRelative(BlockFace.WEST) == b || entity.getLocation().getBlock().getRelative(BlockFace.SOUTH) == b)) { 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)) { if (!EarthMethods.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, launchLocation, impactLocation));
remove(); remove();