These are chat archives for PocketMine/PocketMine-MP

28th
Oct 2016
Addison
@Addison118
Oct 28 2016 05:53
@SOF3 Ive got something to
SOFe
@SOF3
Oct 28 2016 08:50
@Addison118 ?
MΔJΩRHΔRD
@MajorPlayz
Oct 28 2016 09:34
How do I use onBlockBreakEvent?
MΔJΩRHΔRD
@MajorPlayz
Oct 28 2016 09:49
What do I use to detect when a block is broken and then to detect if that block is a MonsterSpawner ?
Anybody?
Anybody?
jasonwynn10
@jasonwynn10
Oct 28 2016 10:26
how about a block break event?
SOFe
@SOF3
Oct 28 2016 11:27
There is nothing called onBlockBreakEvent.
MΔJΩRHΔRD
@MajorPlayz
Oct 28 2016 11:31
How do I do it???
SOFe
@SOF3
Oct 28 2016 11:32
Handle pocketmine\event\block\BlockBreakEvent
you don't need explanation how to make an event handler, right?
MΔJΩRHΔRD
@MajorPlayz
Oct 28 2016 11:32
What does that mean
Yes lol
Ill google it
SOFe
@SOF3
Oct 28 2016 11:37
and then
get the block from the event
then get the block id from the block
MΔJΩRHΔRD
@MajorPlayz
Oct 28 2016 11:38
Ok
SOFe
@SOF3
Oct 28 2016 11:38
then check if the block id is identical to the block id of monster spawner using constants from the block class
MΔJΩRHΔRD
@MajorPlayz
Oct 28 2016 11:38
The class is MonsterSpawner
Cld u write a snippet for that cos I have no idea where to start lel pls
SOFe
@SOF3
Oct 28 2016 11:44
No
don't use the class
use the constant from Block (or BlockIds).
MΔJΩRHΔRD
@MajorPlayz
Oct 28 2016 11:44
OH ok
cld u write a quick snippet pls
SOFe
@SOF3
Oct 28 2016 11:44
no
for what?
MΔJΩRHΔRD
@MajorPlayz
Oct 28 2016 11:45
For that
What function would I use?
onBreak?
SOFe
@SOF3
Oct 28 2016 11:50
You name it.
You can call it any valid function name that doesn't override or duplicate an existing one.
MΔJΩRHΔRD
@MajorPlayz
Oct 28 2016 11:50
onBreak()
SOFe
@SOF3
Oct 28 2016 11:51
@PEMapModder's personal practice is to put an e_ prefix before event handlers as a note to self so that he wouldn't call these functions in code.
MΔJΩRHΔRD
@MajorPlayz
Oct 28 2016 11:51
onBreak()
SOFe
@SOF3
Oct 28 2016 11:52
e_break, e_onBreak, onBreak, break, broken, descanso, enElAlmuerzoODescanso (from Google Translate), etc... all are valid.
as long as they are valid function names.
and there isn't another function with this name.
PocketMine doesn't care what function name you use. It only cares the type hint of the first (and only) parameter of the function.
MΔJΩRHΔRD
@MajorPlayz
Oct 28 2016 12:40
What
OH ok
So do I do (shift+enter for line break) var code = "formatted";
what
var code = "formatted";
ahh
one sec
SOFe
@SOF3
Oct 28 2016 12:45
That's not PHP...
And shift enter is a key in your editor, nothing to do with the code...
And line breaks don't matter in most languages...
MΔJΩRHΔRD
@MajorPlayz
Oct 28 2016 16:31
<?php
onBreak(Item <idOfMonsterSpawner> {
//Code
}
$test = "Code";
ok
But yeh
SOFe
@SOF3
Oct 28 2016 17:09
no...
look at examples. that's all you need for this moment.