/** * Gets the Collision Mode for colliding with the Entity specified * * @param entity to collide with * @return Collision Mode */ public CollisionMode getCollisionMode(Entity entity) { if (!this.getColliding() || entity.isDead()) { return CollisionMode.CANCEL; } MinecartMember<?> member = MinecartMemberStore.get(entity); if (member != null) { if (this.trainCollision == CollisionMode.LINK) { if (member.getGroup().getProperties().trainCollision == CollisionMode.LINK) { return CollisionMode.LINK; } else { return CollisionMode.CANCEL; } } else { return this.trainCollision; } } else if (entity instanceof Player) { if (TrainCarts.collisionIgnoreOwners && this.playerCollision != CollisionMode.DEFAULT) { if (TrainCarts.collisionIgnoreGlobalOwners) { if (CartProperties.hasGlobalOwnership((Player) entity)) { return CollisionMode.DEFAULT; } } if (this.hasOwnership((Player) entity)) { return CollisionMode.DEFAULT; } } return this.playerCollision; } else if (EntityUtil.isMob(entity)) { return this.mobCollision; } else { return this.miscCollision; } }
@Override public boolean hasOwnership(Player player) { return CartProperties.hasGlobalOwnership(player) || this.isOwnedByEveryone() || this.isOwner(player); }