mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2024-11-07 03:19:54 +01:00
Updating block placer
This commit is contained in:
parent
74b26b4a4e
commit
420139551e
@ -79,7 +79,7 @@ public class CoreListeners {
|
|||||||
* @return if the block is allowed to be placed
|
* @return if the block is allowed to be placed
|
||||||
*/
|
*/
|
||||||
public boolean blockPlace(PlayerContainer player, PortalLocation blockPos, String blockMaterial, String itemInHandMaterial, String itemInHandName) {
|
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();
|
WorldContainer world = player.getWorld();
|
||||||
if(itemInHandName.equals("\u00A75Portal Block Placer")) {
|
if(itemInHandName.equals("\u00A75Portal Block Placer")) {
|
||||||
world.setBlock(blockPos, "PORTAL");
|
world.setBlock(blockPos, "PORTAL");
|
||||||
@ -115,13 +115,13 @@ public class CoreListeners {
|
|||||||
*/
|
*/
|
||||||
public boolean playerInteractWithBlock(PlayerContainer player, String materialName, String itemName,
|
public boolean playerInteractWithBlock(PlayerContainer player, String materialName, String itemName,
|
||||||
PortalLocation blockLoc, boolean leftClick) {
|
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())
|
materialName.equalsIgnoreCase(this.portalsCore.getConfig().getSelectorMaterial())
|
||||||
&& (!this.portalsCore.getConfig().getUseOnlySpecialAxe() || itemName.equals("\u00A7ePortal Region Selector"))) {
|
&& (!this.portalsCore.getConfig().getUseOnlySpecialAxe() || itemName.equals("\u00A7ePortal Region Selector"))) {
|
||||||
AdvancedPortalsCore.getPortalManager().playerSelectorActivate(player, blockLoc, leftClick);
|
AdvancedPortalsCore.getPortalManager().playerSelectorActivate(player, blockLoc, leftClick);
|
||||||
return false;
|
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();
|
WorldContainer world = player.getWorld();
|
||||||
if(world.getBlockData(blockLoc) == 1) {
|
if(world.getBlockData(blockLoc) == 1) {
|
||||||
world.setBlockData(blockLoc, (byte) 2);
|
world.setBlockData(blockLoc, (byte) 2);
|
||||||
|
Loading…
Reference in New Issue
Block a user