GenisysPro  for Minecraft PE/Windows 10 v1.1.x
Feature-rich server software for Minecraft PE and Windows 10 Edition
PlayerInteractEvent Class Reference

Public Member Functions

 __construct (Player $player, Item $item, Vector3 $block, $face, $action=PlayerInteractEvent::RIGHT_CLICK_BLOCK)
 
 getAction ()
 
 getItem ()
 
 getBlock ()
 
 getTouchVector ()
 
 getFace ()
 
- Public Member Functions inherited from PlayerEvent
 getPlayer ()
 
- Public Member Functions inherited from Event
 getEventName ()
 
 getHandlers ()
 
- Public Member Functions inherited from Cancellable
 isCancelled ()
 
 setCancelled ($forceCancel=false)
 

Data Fields

const LEFT_CLICK_BLOCK = 0
 
const RIGHT_CLICK_BLOCK = 1
 
const LEFT_CLICK_AIR = 2
 
const RIGHT_CLICK_AIR = 3
 
const PHYSICAL = 4
 

Static Public Attributes

static $handlerList = null
 

Protected Attributes

 $blockTouched
 
 $touchVector
 
 $blockFace
 
 $item
 
 $action
 
- Protected Attributes inherited from PlayerEvent
 $player
 
- Protected Attributes inherited from Event
 $eventName = null
 

Detailed Description

Called when a player interacts or touches a block (including air?)

Constructor & Destructor Documentation

◆ __construct()

__construct ( Player  $player,
Item  $item,
Vector3  $block,
  $face,
  $action = PlayerInteractEvent::RIGHT_CLICK_BLOCK 
)

PlayerInteractEvent constructor.

Parameters
Player$player
Item$item
Vector3$block
$face
int$action
67  {
68  if($block instanceof Block){
69  $this->blockTouched = $block;
70  $this->touchVector = new Vector3(0, 0, 0);
71  }else{
72  $this->touchVector = $block;
73  $this->blockTouched = Block::get(0, 0, new Position(0, 0, 0, $player->level));
74  }
75  $this->player = $player;
76  $this->item = $item;
77  $this->blockFace = (int) $face;
78  $this->action = (int) $action;
79  }

Member Function Documentation

◆ getAction()

getAction ( )
Returns
int
84  {
85  return $this->action;
86  }

◆ getBlock()

getBlock ( )
Returns
Block
98  {
99  return $this->blockTouched;
100  }

◆ getFace()

getFace ( )
Returns
int
112  {
113  return $this->blockFace;
114  }

◆ getItem()

getItem ( )
Returns
Item
91  {
92  return $this->item;
93  }

◆ getTouchVector()

getTouchVector ( )
Returns
Vector3
105  {
106  return $this->touchVector;
107  }

Field Documentation

◆ $action

$action
protected

◆ $blockFace

$blockFace
protected

◆ $blockTouched

$blockTouched
protected

◆ $handlerList

$handlerList = null
static

◆ $item

$item
protected

◆ $touchVector

$touchVector
protected

◆ LEFT_CLICK_AIR

const LEFT_CLICK_AIR = 2

◆ LEFT_CLICK_BLOCK

const LEFT_CLICK_BLOCK = 0

◆ PHYSICAL

const PHYSICAL = 4

◆ RIGHT_CLICK_AIR

const RIGHT_CLICK_AIR = 3

◆ RIGHT_CLICK_BLOCK

const RIGHT_CLICK_BLOCK = 1

The documentation for this class was generated from the following file: