Updating block placer

This commit is contained in:
sekwah 2018-02-22 13:53:07 +00:00
parent 74b26b4a4e
commit 420139551e

View File

@ -79,7 +79,7 @@ public class CoreListeners {
* @return if the block is allowed to be placed
*/
public boolean blockPlace(PlayerContainer player, PortalLocation blockPos, String blockMaterial, String itemInHandMaterial, String itemInHandName) {
if(player != null && player.hasPermission("advancedportals.build")) {
if(itemInHandName != null && player != null && player.hasPermission("advancedportals.build")) {
WorldContainer world = player.getWorld();
if(itemInHandName.equals("\u00A75Portal Block Placer")) {
world.setBlock(blockPos, "PORTAL");
@ -115,13 +115,13 @@ public class CoreListeners {
*/
public boolean playerInteractWithBlock(PlayerContainer player, String materialName, String itemName,
PortalLocation blockLoc, boolean leftClick) {
if((player.isOp() || player.hasPermission("advancedportals.createportal")) &&
if(itemName != null && (player.isOp() || player.hasPermission("advancedportals.createportal")) &&
materialName.equalsIgnoreCase(this.portalsCore.getConfig().getSelectorMaterial())
&& (!this.portalsCore.getConfig().getUseOnlySpecialAxe() || itemName.equals("\u00A7ePortal Region Selector"))) {
AdvancedPortalsCore.getPortalManager().playerSelectorActivate(player, blockLoc, leftClick);
return false;
}
else if(leftClick && itemName.equals("\u00A75Portal Block Placer") && player.hasPermission("advancedportals.build")) {
else if(itemName != null && leftClick && itemName.equals("\u00A75Portal Block Placer") && player.hasPermission("advancedportals.build")) {
WorldContainer world = player.getWorld();
if(world.getBlockData(blockLoc) == 1) {
world.setBlockData(blockLoc, (byte) 2);