Compare commits

...

10 Commits

Author SHA1 Message Date
EvilSeph
36b2175edb Updated version to 1.6.4-R2.1-SNAPSHOT for development towards next release. 2013-10-30 19:44:21 -04:00
EvilSeph
9bbfce7f81 Updated version to 1.6.4-R2.0 in pom.xml for RB. 2013-10-30 19:22:05 -04:00
EvilSeph
bb781cdc2b Updated version to 1.6.4-R1.1-SNAPSHOT for development towards next release. 2013-10-24 02:28:08 -04:00
EvilSeph
1a9d0e3e99 Updated version to 1.6.4-R1.0 in pom.xml for RB. 2013-10-24 01:50:00 -04:00
Luke A
764ea2ec87 Display command-message closing bracket correctly. Fixes BUKKIT-4894
This commit adds proper formatting to the closing bracket used when certain
commands send messages to all players with the broadcast-channel
permission.
2013-10-19 20:41:00 -05:00
Wesley Wolfe
8a93661d2d Fix format of 9cba5ff2b8b3b80068f464fc4cecc3e97b7cf4f1 2013-10-15 04:17:30 -05:00
Wesley Wolfe
ccf8982c63 Update maven compiler to 2.3.2
This change removes a redundant addition of source encoding and makes our
compiler match the current maven default. This amends the commit
52215c617166dddbe52cf7ee8d37964dc948f753

Upstream issue http://jira.codehaus.org/browse/MCOMPILER-70
2013-10-15 04:07:40 -05:00
Wesley Wolfe
bcab013d15 Use simple multiplication for squaring. Fixes BUKKIT-4836
This change adds a method to NumberConversions for squaring and
replaces uses of Math.pow(..., 2) with the new method for efficiency
reasons.
2013-10-09 01:56:35 -05:00
feildmaster
e76be09ae5 Actually display correct effect duration in seconds. Fixes BUKKIT-3983 2013-09-23 13:19:00 -05:00
Joe
ac59a8bdf3 Display correct effect duration in seconds. Fixes BUKKIT-3983 2013-09-23 12:59:02 -05:00
6 changed files with 16 additions and 13 deletions

View File

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId> <artifactId>bukkit</artifactId>
<version>1.6.4-R0.1-SNAPSHOT</version> <version>1.6.4-R2.1-SNAPSHOT</version>
<name>Bukkit</name> <name>Bukkit</name>
<url>http://www.bukkit.org</url> <url>http://www.bukkit.org</url>
@ -43,11 +43,10 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version> <version>2.3.2</version>
<configuration> <configuration>
<source>1.6</source> <source>1.6</source>
<target>1.6</target> <target>1.6</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>

View File

@ -334,7 +334,7 @@ public class Location implements Cloneable {
* @return the magnitude * @return the magnitude
*/ */
public double length() { public double length() {
return Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2) + Math.pow(z, 2)); return Math.sqrt(NumberConversions.square(x) + NumberConversions.square(y) + NumberConversions.square(z));
} }
/** /**
@ -345,7 +345,7 @@ public class Location implements Cloneable {
* @return the magnitude * @return the magnitude
*/ */
public double lengthSquared() { public double lengthSquared() {
return Math.pow(x, 2) + Math.pow(y, 2) + Math.pow(z, 2); return NumberConversions.square(x) + NumberConversions.square(y) + NumberConversions.square(z);
} }
/** /**
@ -381,7 +381,7 @@ public class Location implements Cloneable {
throw new IllegalArgumentException("Cannot measure distance between " + getWorld().getName() + " and " + o.getWorld().getName()); throw new IllegalArgumentException("Cannot measure distance between " + getWorld().getName() + " and " + o.getWorld().getName());
} }
return Math.pow(x - o.x, 2) + Math.pow(y - o.y, 2) + Math.pow(z - o.z, 2); return NumberConversions.square(x - o.x) + NumberConversions.square(y - o.y) + NumberConversions.square(z - o.z);
} }
/** /**

View File

@ -345,7 +345,7 @@ public abstract class Command {
} }
Set<Permissible> users = Bukkit.getPluginManager().getPermissionSubscriptions(Server.BROADCAST_CHANNEL_ADMINISTRATIVE); Set<Permissible> users = Bukkit.getPluginManager().getPermissionSubscriptions(Server.BROADCAST_CHANNEL_ADMINISTRATIVE);
String colored = ChatColor.GRAY + "" + ChatColor.ITALIC + "[" + result + "]"; String colored = ChatColor.GRAY + "" + ChatColor.ITALIC + "[" + result + ChatColor.GRAY + ChatColor.ITALIC + "]";
if (sendToSource && !(source instanceof ConsoleCommandSender)) { if (sendToSource && !(source instanceof ConsoleCommandSender)) {
source.sendMessage(message); source.sendMessage(message);

View File

@ -100,7 +100,7 @@ public class EffectCommand extends VanillaCommand {
final PotionEffect applyEffect = new PotionEffect(effect, duration, amplification); final PotionEffect applyEffect = new PotionEffect(effect, duration, amplification);
player.addPotionEffect(applyEffect, true); player.addPotionEffect(applyEffect, true);
broadcastCommandMessage(sender, String.format("Given %s (ID %d) * %d to %s for %d seconds", effect.getName(), effect.getId(), amplification, args[0], duration)); broadcastCommandMessage(sender, String.format("Given %s (ID %d) * %d to %s for %d seconds", effect.getName(), effect.getId(), amplification, args[0], duration_temp));
} }
return true; return true;

View File

@ -20,6 +20,10 @@ public final class NumberConversions {
return floor(num + 0.5d); return floor(num + 0.5d);
} }
public static double square(double num) {
return num * num;
}
public static int toInt(Object object) { public static int toInt(Object object) {
if (object instanceof Number) { if (object instanceof Number) {
return ((Number) object).intValue(); return ((Number) object).intValue();

View File

@ -152,7 +152,7 @@ public class Vector implements Cloneable, ConfigurationSerializable {
* @return the magnitude * @return the magnitude
*/ */
public double length() { public double length() {
return Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2) + Math.pow(z, 2)); return Math.sqrt(NumberConversions.square(x) + NumberConversions.square(y) + NumberConversions.square(z));
} }
/** /**
@ -161,7 +161,7 @@ public class Vector implements Cloneable, ConfigurationSerializable {
* @return the magnitude * @return the magnitude
*/ */
public double lengthSquared() { public double lengthSquared() {
return Math.pow(x, 2) + Math.pow(y, 2) + Math.pow(z, 2); return NumberConversions.square(x) + NumberConversions.square(y) + NumberConversions.square(z);
} }
/** /**
@ -175,7 +175,7 @@ public class Vector implements Cloneable, ConfigurationSerializable {
* @return the distance * @return the distance
*/ */
public double distance(Vector o) { public double distance(Vector o) {
return Math.sqrt(Math.pow(x - o.x, 2) + Math.pow(y - o.y, 2) + Math.pow(z - o.z, 2)); return Math.sqrt(NumberConversions.square(x - o.x) + NumberConversions.square(y - o.y) + NumberConversions.square(z - o.z));
} }
/** /**
@ -185,7 +185,7 @@ public class Vector implements Cloneable, ConfigurationSerializable {
* @return the distance * @return the distance
*/ */
public double distanceSquared(Vector o) { public double distanceSquared(Vector o) {
return Math.pow(x - o.x, 2) + Math.pow(y - o.y, 2) + Math.pow(z - o.z, 2); return NumberConversions.square(x - o.x) + NumberConversions.square(y - o.y) + NumberConversions.square(z - o.z);
} }
/** /**
@ -346,7 +346,7 @@ public class Vector implements Cloneable, ConfigurationSerializable {
* @return whether this vector is in the sphere * @return whether this vector is in the sphere
*/ */
public boolean isInSphere(Vector origin, double radius) { public boolean isInSphere(Vector origin, double radius) {
return (Math.pow(origin.x - x, 2) + Math.pow(origin.y - y, 2) + Math.pow(origin.z - z, 2)) <= Math.pow(radius, 2); return (NumberConversions.square(origin.x - x) + NumberConversions.square(origin.y - y) + NumberConversions.square(origin.z - z)) <= NumberConversions.square(radius);
} }
/** /**