mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 15:47:44 +01:00
Check for plgins setting null locations/worlds
This commit is contained in:
parent
98272bf282
commit
a1b03fa25d
1 changed files with 44 additions and 0 deletions
|
@ -0,0 +1,44 @@
|
||||||
|
From 30c208e767b0d5912ed4302f40bfbb258b314bf6 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Thinkofdeath <thinkofdeath@spigotmc.org>
|
||||||
|
Date: Sun, 11 May 2014 10:03:12 +0100
|
||||||
|
Subject: [PATCH] Check for plugins setting null locations/worlds
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java b/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java
|
||||||
|
index fa3b340..8908b68 100644
|
||||||
|
--- a/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java
|
||||||
|
+++ b/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java
|
||||||
|
@@ -5,6 +5,8 @@ import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
+import org.apache.commons.lang.Validate; // Spigot
|
||||||
|
+
|
||||||
|
/**
|
||||||
|
* Holds information for player movement events
|
||||||
|
*/
|
||||||
|
@@ -63,6 +65,10 @@ public class PlayerMoveEvent extends PlayerEvent implements Cancellable {
|
||||||
|
* @param from New location to mark as the players previous location
|
||||||
|
*/
|
||||||
|
public void setFrom(Location from) {
|
||||||
|
+ // Spigot start
|
||||||
|
+ Validate.notNull(from, "from location cannot be null");
|
||||||
|
+ Validate.notNull(from.getWorld(), "from location's world cannot be null");
|
||||||
|
+ // Spigot end
|
||||||
|
this.from = from;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -81,6 +87,10 @@ public class PlayerMoveEvent extends PlayerEvent implements Cancellable {
|
||||||
|
* @param to New Location this player will move to
|
||||||
|
*/
|
||||||
|
public void setTo(Location to) {
|
||||||
|
+ // Spigot start
|
||||||
|
+ Validate.notNull(to, "to location cannot be null");
|
||||||
|
+ Validate.notNull(to.getWorld(), "to location's world cannot be null");
|
||||||
|
+ // Spigot end
|
||||||
|
this.to = to;
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
1.9.1
|
||||||
|
|
Loading…
Reference in a new issue