CortexPE / Commando

A Command Framework virion for PocketMine-MP
GNU Lesser General Public License v3.0
70 stars 53 forks source link

PacketHooker: Fix isRegistered() does not work #35

Closed PJZ9n closed 2 years ago

PJZ9n commented 2 years ago

Hi, this fixes an issue where PacketHooker::isRegistered() doesn't work.

Call PacketHooker::register(), PacketHooker::isRegistered() should return true. but it returns false. And since the flag has not been updated, multiple registration is possible without exception.

var_dump(PacketHooker::isRegistered());
PacketHooker::register($this);
var_dump(PacketHooker::isRegistered());
PacketHooker::register($this);

result:

bool(false)
bool(false)
inxomnyaa commented 2 years ago

Looks like master also had this issue 👀 I was wondering if the bool should be set at the end of the method instead, in case SimplePacketHandler throws some issue