NPE fix ;D!

This commit is contained in:
Steffion 2013-07-30 20:50:50 +02:00
parent cd68ccf261
commit a8a96b7822

View File

@ -7,6 +7,7 @@ import nl.Steffion.BlockHunt.Managers.PlayerM;
import nl.Steffion.BlockHunt.Managers.PlayerM.PermsC;
import nl.Steffion.BlockHunt.Serializables.LocationSerializable;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@ -29,7 +30,7 @@ public class PlayerListener implements Listener {
Player player = event.getPlayer();
if (PlayerM.hasPerm(player, PermsC.create, false)) {
ItemStack item = player.getItemInHand();
if (item.getType() != Material.AIR) {
if (item.getItemMeta().hasDisplayName()) {
ItemMeta im = item.getItemMeta();
if (im.getDisplayName().equals(
@ -52,7 +53,8 @@ public class PlayerListener implements Listener {
+ "%N, %A"
+ location.getBlockY()
+ "%N, %A"
+ location.getBlockZ() + "%N)");
+ location.getBlockZ()
+ "%N)");
W.pos1.put(player, location);
}
} else if (action.equals(Action.RIGHT_CLICK_BLOCK)) {
@ -68,7 +70,8 @@ public class PlayerListener implements Listener {
+ "%N, %A"
+ location.getBlockY()
+ "%N, %A"
+ location.getBlockZ() + "%N)");
+ location.getBlockZ()
+ "%N)");
W.pos2.put(player, location);
}
}
@ -77,6 +80,7 @@ public class PlayerListener implements Listener {
}
}
}
}
// @EventHandler(priority = EventPriority.MONITOR)
// public void onPlayerTeleportEvent(final PlayerTeleportEvent event) {
// final Player player = event.getPlayer();