Package com.bergerkiller.bukkit.common.controller

Examples of com.bergerkiller.bukkit.common.controller.EntityNetworkController


  @SuppressWarnings({"unchecked", "rawtypes"})
  public EntityNetworkController<CommonEntity<T>> getNetworkController() {
    if (EntityRef.world.getInternal(getHandle()) == null) {
      return null;
    }
    final EntityNetworkController result;
    final Object entityTrackerEntry = WorldUtil.getTrackerEntry(entity);
    if (entityTrackerEntry == null) {
      return null;
    } else if (entityTrackerEntry instanceof NMSEntityTrackerEntry) {
      result = ((NMSEntityTrackerEntry) entityTrackerEntry).getController();
    } else if (EntityTrackerEntry.class.equals(entityTrackerEntry.getClass())) {
      result = new DefaultEntityNetworkController();
      result.bind(this, entityTrackerEntry);
    } else {
      result = new ExternalEntityNetworkController();
      result.bind(this, entityTrackerEntry);
    }
    return result;
  }
View Full Code Here


    final EntityTracker tracker = WorldUtil.getTracker(getWorld());
    final Object storedEntry = tracker.getEntry(entity);

    // Properly handle a previously set controller
    if (storedEntry instanceof NMSEntityTrackerEntry) {
      final EntityNetworkController oldController = ((NMSEntityTrackerEntry) storedEntry).getController();
      if (oldController == controller) {
        return;
      } else if (oldController != null) {
        oldController.onDetached();
      }
    }

    // Take care of null controllers - stop tracking
    if (controller == null) {
View Full Code Here

TOP

Related Classes of com.bergerkiller.bukkit.common.controller.EntityNetworkController

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.