Fixed potential nullpointer exception(s)

Not sure if these tecnically could actually happen, but its probably
better to fix a nonissue than to not to fix an issue.
This commit is contained in:
Evenprime 2011-03-11 09:00:20 +01:00
parent e388d44719
commit 6cca892298
3 changed files with 12 additions and 9 deletions

View File

@ -3,7 +3,7 @@ name: NoCheatPlugin
author: Evenprime
main: cc.co.evenprime.bukkit.nocheat.NoCheatPlugin
version: 0.6.6a
version: 0.6.7
commands:
nocheat:

View File

@ -392,12 +392,13 @@ public class MovingCheck {
// to lost vertical momentum to prevent him from getting stuck
data.movingJumpPhase = 0;
Location l = data.movingSetBackPoint;
// If we have stored a location for the player, we put him back there
if(data.movingSetBackPoint != null) {
if(l != null) {
// Lets try it that way. Maybe now people don't "disappear" any longer
event.setFrom(data.movingSetBackPoint);
event.setTo(data.movingSetBackPoint);
event.getPlayer().teleportTo(data.movingSetBackPoint);
event.setFrom(l);
event.setTo(l);
event.getPlayer().teleportTo(l);
}
else {
// Lets try it that way. Maybe now people don't "disappear" any longer

View File

@ -1,5 +1,6 @@
package cc.co.evenprime.bukkit.nocheat.checks;
import org.bukkit.Location;
import org.bukkit.event.player.PlayerMoveEvent;
import cc.co.evenprime.bukkit.nocheat.NoCheatConfiguration;
@ -85,13 +86,14 @@ public class SpeedhackCheck {
private static void resetPlayer(PlayerMoveEvent event, NoCheatData data) {
Location l = data.speedhackSetBackPoint;
// If we have stored a location for the player, we put him back there
if(data.speedhackSetBackPoint != null) {
if(l != null) {
// Lets try it that way. Maybe now people don't "disappear" any longer
event.setFrom(data.speedhackSetBackPoint);
event.setTo(data.speedhackSetBackPoint);
event.getPlayer().teleportTo(data.speedhackSetBackPoint);
event.setFrom(l);
event.setTo(l);
event.getPlayer().teleportTo(l);
}
else {
// Lets try it that way. Maybe now people don't "disappear" any longer