@Override public void syncEntity(Entity e) { if (e == null) { return; } Controller c = e.getController(); if (c != null) { EntityProtocol ep = c.getType().getEntityProtocol(VanillaPlugin.VANILLA_PROTOCOL_ID); if (ep != null) { Message[] sync = ep.getUpdateMessage(e); if (sync != null) { session.sendAll(false, sync); } } } super.syncEntity(e); }
@Override public void destroyEntity(Entity e) { if (e == null) { return; } Controller c = e.getController(); if (c != null) { EntityProtocol ep = c.getType().getEntityProtocol(VanillaPlugin.VANILLA_PROTOCOL_ID); if (ep != null) { Message[] death = ep.getDestroyMessage(e); if (death != null) { session.sendAll(false, death); } } } super.destroyEntity(e); }
@Override public void syncEntity(Entity e, boolean spawn, boolean destroy, boolean update) { EntityProtocol ep = e.getNetwork().getEntityProtocol(VanillaPlugin.VANILLA_PROTOCOL_ID); if (ep != null) { List<Message> messages = new ArrayList<Message>(3); // Sync using vanilla protocol if (destroy) { messages.addAll(ep.getDestroyMessages(e)); } if (spawn) { messages.addAll(ep.getSpawnMessages(e)); } if (update) { messages.addAll(ep.getUpdateMessages(e)); } for (Message message : messages) { this.session.send(false, message); } } }
@Override public void syncEntity( Entity e, Transform liveTransform, boolean spawn, boolean destroy, boolean update) { super.syncEntity(e, liveTransform, spawn, destroy, update); EntityProtocol ep = e.getNetwork().getEntityProtocol(VanillaPlugin.VANILLA_PROTOCOL_ID); if (ep != null) { List<Message> messages = new ArrayList<Message>(); // Sync using vanilla protocol if (destroy) { messages.addAll(ep.getDestroyMessages(e)); } if (spawn) { messages.addAll(ep.getSpawnMessages(e, getRepositionManager())); } if (update) { boolean force = shouldForce(e.getId()); messages.addAll(ep.getUpdateMessages(e, liveTransform, getRepositionManager(), force)); } for (Message message : messages) { this.session.send(false, message); } } }