Closed Invy55 closed 4 years ago
I don't see what you mean or what you are asking here.
Ok, so:
public function anormaleventlistenerfunction(EntityLevelChangeEvent $event){
var_dump($event);
}
I've this very simple function that checks for the EntityLevelChangeEvent and dumps its contents in the console.
Then in that function I need to get the entity that is triggering the event, with:
$entity = $event->getEntity();
and then $entity->setHunger(20); // to set entity hunger (obviusly after checking for the entity to be a player)
Which trow an error saying:
Error: "Call to undefined method jasonwynn10\EasyCommandAutofill\AutofillPlayer::setHunger()" (EXCEPTION) in "plugins/NoStarving/src/Invy55/NoStarving/Main" at line 32
Oh I see. It's not actually my plugin which is causing the issue. There is no setHunger()
function in the base Player class.
I sincerally don't know if this is really an issue but when my script dump the event (EntityLevelChangeEvent) and the plugin is installed I can see that
entity is changed from the correct:
so obviusly my plugin don't work.
PS: Can you please make me an example of how your plugin work?