Remove gadgets from world when a player leaves

This commit is contained in:
Melledy
2022-04-17 23:43:47 -07:00
parent c919c9c9eb
commit ad57bb91df
3 changed files with 24 additions and 4 deletions

View File

@@ -19,6 +19,11 @@ public class HandlerEvtCreateGadgetNotify extends PacketHandler {
return;
}
// Sanity check - dont add duplicate entities
if (session.getPlayer().getWorld().getEntityById(notify.getEntityId()) != null) {
return;
}
// Create entity and summon in world
EntityClientGadget gadget = new EntityClientGadget(session.getPlayer().getWorld(), session.getPlayer(), notify);
session.getPlayer().getWorld().onPlayerCreateGadget(gadget);