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

Public Member Functions

 __construct (Level $level, CompoundTag $nbt)
 
 saveNBT ()
 
 setText ($line1="", $line2="", $line3="", $line4="")
 
 getText ()
 
 getSpawnCompound ()
 
 updateCompoundTag (CompoundTag $nbt, Player $player)
 
- Public Member Functions inherited from Spawnable
 spawnTo (Player $player)
 
 __construct (Level $level, CompoundTag $nbt)
 
 spawnToAll ()
 
 getSpawnCompound ()
 
 updateCompoundTag (CompoundTag $nbt, Player $player)
 
- Public Member Functions inherited from Tile
 getSaveId ()
 
 __construct (Level $level, CompoundTag $nbt)
 
 getId ()
 
 saveNBT ()
 
 getBlock ()
 
 onUpdate ()
 
 scheduleUpdate ()
 
 __destruct ()
 
 close ()
 
 getName ()
 
- Public Member Functions inherited from Position
 __construct ($x=0, $y=0, $z=0, Level $level=null)
 
 asPosition ()
 
 add ($x, $y=0, $z=0)
 
 getLevel ()
 
 setLevel (Level $level=null)
 
 isValid ()
 
 getSide ($side, $step=1)
 
 __toString ()
 
 setComponents ($x, $y, $z)
 
 fromObjectAdd (Vector3 $pos, $x, $y, $z)
 
- Public Member Functions inherited from Vector3
 __construct ($x=0, $y=0, $z=0)
 
 getX ()
 
 getY ()
 
 getZ ()
 
 getFloorX ()
 
 getFloorY ()
 
 getFloorZ ()
 
 getRight ()
 
 getUp ()
 
 getForward ()
 
 getSouth ()
 
 getWest ()
 
 add ($x, $y=0, $z=0)
 
 subtract ($x=0, $y=0, $z=0)
 
 multiply ($number)
 
 divide ($number)
 
 ceil ()
 
 floor ()
 
 round ()
 
 abs ()
 
 getSide ($side, $step=1)
 
 asVector3 ()
 
 distance (Vector3 $pos)
 
 distanceSquared (Vector3 $pos)
 
 maxPlainDistance ($x=0, $z=0)
 
 length ()
 
 lengthSquared ()
 
 normalize ()
 
 dot (Vector3 $v)
 
 cross (Vector3 $v)
 
 equals (Vector3 $v)
 
 getIntermediateWithXValue (Vector3 $v, $x)
 
 getIntermediateWithYValue (Vector3 $v, $y)
 
 getIntermediateWithZValue (Vector3 $v, $z)
 
 setComponents ($x, $y, $z)
 
 fromObjectAdd (Vector3 $pos, $x, $y, $z)
 
 __toString ()
 

Additional Inherited Members

- Static Public Member Functions inherited from Tile
static init ()
 
static createTile ($type, Level $level, CompoundTag $nbt,... $args)
 
static registerTile ($className)
 
- Static Public Member Functions inherited from Position
static fromObject (Vector3 $pos, Level $level=null)
 
- Static Public Member Functions inherited from Vector3
static getOppositeSide ($side)
 
static createRandomDirection (Random $random)
 
- Data Fields inherited from Tile
const BREWING_STAND = "BrewingStand"
 
const CHEST = "Chest"
 
const DL_DETECTOR = "DayLightDetector"
 
const ENCHANT_TABLE = "EnchantTable"
 
const FLOWER_POT = "FlowerPot"
 
const FURNACE = "Furnace"
 
const MOB_SPAWNER = "MobSpawner"
 
const SIGN = "Sign"
 
const SKULL = "Skull"
 
const ITEM_FRAME = "ItemFrame"
 
const DISPENSER = "Dispenser"
 
const DROPPER = "Dropper"
 
const CAULDRON = "Cauldron"
 
const HOPPER = "Hopper"
 
const BEACON = "Beacon"
 
const ENDER_CHEST = "EnderChest"
 
const BED = "Bed"
 
const DAY_LIGHT_DETECTOR = "DLDetector"
 
 $chunk
 
 $name
 
 $id
 
 $x
 
 $y
 
 $z
 
 $attach
 
 $metadata
 
 $closed = false
 
 $namedtag
 
 $tickTimer
 
- Data Fields inherited from Position
 $level = null
 
- Data Fields inherited from Vector3
const SIDE_DOWN = 0
 
const SIDE_UP = 1
 
const SIDE_NORTH = 2
 
const SIDE_SOUTH = 3
 
const SIDE_WEST = 4
 
const SIDE_EAST = 5
 
 $x
 
 $y
 
 $z
 
- Static Public Attributes inherited from Tile
static $tileCount = 1
 
- Protected Member Functions inherited from Spawnable
 onChanged ()
 
- Protected Attributes inherited from Tile
 $lastUpdate
 
 $server
 
 $timings
 

Constructor & Destructor Documentation

◆ __construct()

__construct ( Level  $level,
CompoundTag  $nbt 
)

Sign constructor.

Parameters
Level$level
CompoundTag$nbt
40  {
41  if(!isset($nbt->Text1)){
42  $nbt->Text1 = new StringTag("Text1", "");
43  }
44  if(!isset($nbt->Text2) or !($nbt->Text2 instanceof StringTag)){
45  $nbt->Text2 = new StringTag("Text2", "");
46  }
47  if(!isset($nbt->Text3) or !($nbt->Text3 instanceof StringTag)){
48  $nbt->Text3 = new StringTag("Text3", "");
49  }
50  if(!isset($nbt->Text4) or !($nbt->Text4 instanceof StringTag)){
51  $nbt->Text4 = new StringTag("Text4", "");
52  }
53 
54  parent::__construct($level, $nbt);
55  }

Member Function Documentation

◆ getSpawnCompound()

getSpawnCompound ( )
Returns
CompoundTag
95  {
96  return new CompoundTag("", [
97  new StringTag("id", Tile::SIGN),
98  $this->namedtag->Text1,
99  $this->namedtag->Text2,
100  $this->namedtag->Text3,
101  $this->namedtag->Text4,
102  new IntTag("x", (int) $this->x),
103  new IntTag("y", (int) $this->y),
104  new IntTag("z", (int) $this->z)
105  ]);
106  }

◆ getText()

getText ( )
Returns
array
83  {
84  return [
85  $this->namedtag["Text1"],
86  $this->namedtag["Text2"],
87  $this->namedtag["Text3"],
88  $this->namedtag["Text4"]
89  ];
90  }

◆ saveNBT()

saveNBT ( )
57  {
58  parent::saveNBT();
59  unset($this->namedtag->Creator);
60  }

◆ setText()

setText (   $line1 = "",
  $line2 = "",
  $line3 = "",
  $line4 = "" 
)
Parameters
string$line1
string$line2
string$line3
string$line4
Returns
bool
70  {
71  $this->namedtag->Text1 = new StringTag("Text1", $line1);
72  $this->namedtag->Text2 = new StringTag("Text2", $line2);
73  $this->namedtag->Text3 = new StringTag("Text3", $line3);
74  $this->namedtag->Text4 = new StringTag("Text4", $line4);
75  $this->onChanged();
76 
77  return true;
78  }

◆ updateCompoundTag()

updateCompoundTag ( CompoundTag  $nbt,
Player  $player 
)
Parameters
CompoundTag$nbt
Player$player
Returns
bool
114  : bool{
115  if($nbt["id"] !== Tile::SIGN){
116  return false;
117  }
118 
119  $ev = new SignChangeEvent($this->getBlock(), $player, [
120  TextFormat::clean($nbt["Text1"], ($removeFormat = $player->getRemoveFormat())),
121  TextFormat::clean($nbt["Text2"], $removeFormat),
122  TextFormat::clean($nbt["Text3"], $removeFormat),
123  TextFormat::clean($nbt["Text4"], $removeFormat)
124  ]);
125 
126  if(!isset($this->namedtag->Creator) or $this->namedtag["Creator"] !== $player->getRawUniqueId()){
127  $ev->setCancelled();
128  }
129 
130  $this->level->getServer()->getPluginManager()->callEvent($ev);
131 
132  if(!$ev->isCancelled()){
133  $this->setText(...$ev->getLines());
134  return true;
135  }else{
136  return false;
137  }
138  }

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