NPE fix ;D!
This commit is contained in:
parent
cd68ccf261
commit
a8a96b7822
@ -7,6 +7,7 @@ import nl.Steffion.BlockHunt.Managers.PlayerM;
|
|||||||
import nl.Steffion.BlockHunt.Managers.PlayerM.PermsC;
|
import nl.Steffion.BlockHunt.Managers.PlayerM.PermsC;
|
||||||
import nl.Steffion.BlockHunt.Serializables.LocationSerializable;
|
import nl.Steffion.BlockHunt.Serializables.LocationSerializable;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@ -29,7 +30,7 @@ public class PlayerListener implements Listener {
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if (PlayerM.hasPerm(player, PermsC.create, false)) {
|
if (PlayerM.hasPerm(player, PermsC.create, false)) {
|
||||||
ItemStack item = player.getItemInHand();
|
ItemStack item = player.getItemInHand();
|
||||||
|
if (item.getType() != Material.AIR) {
|
||||||
if (item.getItemMeta().hasDisplayName()) {
|
if (item.getItemMeta().hasDisplayName()) {
|
||||||
ItemMeta im = item.getItemMeta();
|
ItemMeta im = item.getItemMeta();
|
||||||
if (im.getDisplayName().equals(
|
if (im.getDisplayName().equals(
|
||||||
@ -52,7 +53,8 @@ public class PlayerListener implements Listener {
|
|||||||
+ "%N, %A"
|
+ "%N, %A"
|
||||||
+ location.getBlockY()
|
+ location.getBlockY()
|
||||||
+ "%N, %A"
|
+ "%N, %A"
|
||||||
+ location.getBlockZ() + "%N)");
|
+ location.getBlockZ()
|
||||||
|
+ "%N)");
|
||||||
W.pos1.put(player, location);
|
W.pos1.put(player, location);
|
||||||
}
|
}
|
||||||
} else if (action.equals(Action.RIGHT_CLICK_BLOCK)) {
|
} else if (action.equals(Action.RIGHT_CLICK_BLOCK)) {
|
||||||
@ -68,7 +70,8 @@ public class PlayerListener implements Listener {
|
|||||||
+ "%N, %A"
|
+ "%N, %A"
|
||||||
+ location.getBlockY()
|
+ location.getBlockY()
|
||||||
+ "%N, %A"
|
+ "%N, %A"
|
||||||
+ location.getBlockZ() + "%N)");
|
+ location.getBlockZ()
|
||||||
|
+ "%N)");
|
||||||
W.pos2.put(player, location);
|
W.pos2.put(player, location);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -77,6 +80,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// @EventHandler(priority = EventPriority.MONITOR)
|
// @EventHandler(priority = EventPriority.MONITOR)
|
||||||
// public void onPlayerTeleportEvent(final PlayerTeleportEvent event) {
|
// public void onPlayerTeleportEvent(final PlayerTeleportEvent event) {
|
||||||
// final Player player = event.getPlayer();
|
// final Player player = event.getPlayer();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user