From abf78c49bb702a97b71ac861cd74cb581de2da27 Mon Sep 17 00:00:00 2001 From: Steven Lawson Date: Sat, 1 Dec 2012 14:11:10 -0500 Subject: [PATCH] Fix expel. Fix regex. --- .../TotalFreedomMod/Commands/Command_expel.java | 14 ++++++-------- src/me/StevenLawson/TotalFreedomMod/TFM_Util.java | 4 ++-- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_expel.java b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_expel.java index e8beba98..448a175a 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Commands/Command_expel.java +++ b/src/me/StevenLawson/TotalFreedomMod/Commands/Command_expel.java @@ -4,7 +4,6 @@ import org.bukkit.Location; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import org.bukkit.util.Vector; @CommandPermissions(level = ADMIN_LEVEL.SUPER, source = SOURCE_TYPE_ALLOWED.ONLY_IN_GAME, ignore_permissions = false) public class Command_expel extends TFM_Command @@ -12,14 +11,14 @@ public class Command_expel extends TFM_Command @Override public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { - double radius = 50.0; - double strength = 100.0; + double radius = 15.0; + double strength = 20.0; if (args.length >= 1) { try { - radius = Math.max(1.0, Math.min(200.0, Double.parseDouble(args[0]))); + radius = Math.max(1.0, Math.min(100.0, Double.parseDouble(args[0]))); } catch (NumberFormatException nfex) { @@ -30,7 +29,7 @@ public class Command_expel extends TFM_Command { try { - strength = Math.max(0.0, Math.min(200.0, Double.parseDouble(args[1]))); + strength = Math.max(0.0, Math.min(50.0, Double.parseDouble(args[1]))); } catch (NumberFormatException nfex) { @@ -55,9 +54,8 @@ public class Command_expel extends TFM_Command if (in_range) { - sender.sendMessage("Pushing " + p.getName()); - Vector expel_direction = target_pos.subtract(sender_pos).toVector().normalize(); - p.setVelocity(expel_direction.multiply(strength)); + p.setVelocity(target_pos.clone().subtract(sender_pos).toVector().normalize().multiply(strength)); + sender.sendMessage("Pushing " + p.getName() + "."); } } } diff --git a/src/me/StevenLawson/TotalFreedomMod/TFM_Util.java b/src/me/StevenLawson/TotalFreedomMod/TFM_Util.java index a4f15ef6..2009a1ee 100644 --- a/src/me/StevenLawson/TotalFreedomMod/TFM_Util.java +++ b/src/me/StevenLawson/TotalFreedomMod/TFM_Util.java @@ -930,8 +930,8 @@ public class TFM_Util { boolean is_match = true; - String[] a_parts = StringUtils.split(a, '.'); - String[] b_parts = StringUtils.split(b, '.'); + String[] a_parts = a.split("\\."); + String[] b_parts = b.split("\\."); if (a_parts.length != 4 || b_parts.length != 4) {