summaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/bukkit/event/player/PlayerMoveEvent.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java b/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java
index fa3b340e..8debcda7 100644
--- a/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java
+++ b/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java
@@ -1,5 +1,6 @@
package org.bukkit.event.player;
+import com.google.common.base.Preconditions;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
@@ -63,6 +64,7 @@ public class PlayerMoveEvent extends PlayerEvent implements Cancellable {
* @param from New location to mark as the players previous location
*/
public void setFrom(Location from) {
+ validateLocation(to);
this.from = from;
}
@@ -81,9 +83,14 @@ public class PlayerMoveEvent extends PlayerEvent implements Cancellable {
* @param to New Location this player will move to
*/
public void setTo(Location to) {
+ validateLocation(to);
this.to = to;
}
+ private void validateLocation(Location loc) {
+ Preconditions.checkArgument(loc != null, "Cannot use location with null world!");
+ }
+
@Override
public HandlerList getHandlers() {
return handlers;