mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-12-27 20:27:37 +00:00
Fix expel.
Fix regex.
This commit is contained in:
parent
f5891ae23b
commit
abf78c49bb
@ -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() + ".");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user