Examples of Attachable


Examples of org.bukkit.material.Attachable

                }
                return;
            case BlockID.STONE_BUTTON:
            case BlockID.WOODEN_BUTTON:
            case BlockID.LEVER:
                Attachable button = (Attachable) block.getState().getData();
                if(button != null) {
                    BlockFace face = button.getAttachedFace();
                    if(face != null)
                        handleDirectWireInput(new WorldVector(w, x + face.getModX()*2, y, z + face.getModZ()*2), block, oldLevel, newLevel);
                }
        }

View Full Code Here

Examples of org.bukkit.material.Attachable

            if (event.getTo().getBlock().getType() == Material.STONE_PLATE || event.getTo().getBlock().getType() == Material.WOOD_PLATE || event.getTo().getBlock().getType() == Material.GOLD_PLATE || event.getTo().getBlock().getType() == Material.IRON_PLATE)
                event.getVehicle().setVelocity(event.getVehicle().getVelocity().normalize().multiply(4));

        if (ladder)
            if (event.getTo().getBlock().getType() == Material.LADDER) {
                Attachable ladder = (Attachable) event.getTo().getBlock().getState().getData();
                Vector velocity = new Vector(0,ladderVerticalVelocity,((Attachable) event.getTo().getBlock().getState().getData()).getAttachedFace().getModZ());
                if(velocity.length() > ((Minecart) event.getVehicle()).getMaxSpeed()) {
                    double length = velocity.length()/((Minecart) event.getVehicle()).getMaxSpeed();
                    velocity.setX(velocity.getX() / length);
                    velocity.setY(velocity.getY() / length);
                    velocity.setZ(velocity.getZ() / length);
                }
                velocity.add(new Vector(ladder.getAttachedFace().getModX(), 0, ladder.getAttachedFace().getModZ()));
                event.getVehicle().setVelocity(event.getVehicle().getVelocity().add(velocity));
            } else if (event.getTo().getBlock().getType() == Material.VINE) {
                BlockFace movementFace = BlockFace.SELF;
                Vine vine = (Vine) event.getTo().getBlock().getState().getData();
                for(BlockFace test : LocationUtil.getDirectFaces())
View Full Code Here

Examples of org.bukkit.material.Attachable

    }
    final MaterialData mdata = type.getNewData((byte) rawData);

    // Fix attachable face returning NULL sometimes
    if (mdata instanceof Attachable) {
      Attachable att = (Attachable) mdata;
      if (att.getAttachedFace() == null) {
        att.setFacingDirection(BlockFace.NORTH);
      }
    }
    return mdata;
  }
View Full Code Here

Examples of org.bukkit.material.Attachable

   *
   * @param attachable block
   * @return Attached face
   */
  public static BlockFace getAttachedFace(org.bukkit.block.Block attachable) {
    Attachable data = getData(attachable, Attachable.class);
    return data == null ? BlockFace.DOWN : data.getAttachedFace();
  }
View Full Code Here

Examples of org.bukkit.material.Attachable

    }

    // Towny regen
    if (TownySettings.getRegenDelay() > 0) {
      if (event.getClickedBlock().getState().getData() instanceof Attachable) {
        Attachable attachable = (Attachable) event.getClickedBlock().getState().getData();
        BlockLocation attachedToBlock = new BlockLocation(event.getClickedBlock().getRelative(attachable.getAttachedFace()).getLocation());
        // Prevent attached blocks from falling off when interacting
        if (plugin.getTownyUniverse().hasProtectionRegenTask(attachedToBlock)) {
          event.setCancelled(true);
        }
      }
View Full Code Here

Examples of org.jboss.as.server.deployment.Attachable

    public static DeploymentUnit mockDeploymentUnit() {
        return mockDeploymentUnit("Mock Deployment Unit");
    }

    public static DeploymentUnit mockDeploymentUnit(String duName) {
        final Attachable attachable = new SimpleAttachable();
        final DeploymentUnit deploymentUnit = mock(DeploymentUnit.class);
        when(deploymentUnit.getName()).thenReturn(duName);

        when(deploymentUnit.getAttachment((AttachmentKey<Object>) any())).thenAnswer(new Answer() {
            @Override
            public Object answer(InvocationOnMock invocation) throws Throwable {
                AttachmentKey<?> key = (AttachmentKey<?>) invocation.getArguments()[0];
                return attachable.getAttachment(key);
            }
        });
        when(deploymentUnit.putAttachment((AttachmentKey<Object>) any(), any())).thenAnswer(new Answer() {
            @Override
            public Object answer(InvocationOnMock invocation) throws Throwable {
                AttachmentKey<Object> key = (AttachmentKey<Object>) invocation.getArguments()[0];
                Object value = invocation.getArguments()[1];
                return attachable.putAttachment(key, value);
            }
        });
        ServiceName deploymentUnitServiceName = Services.deploymentUnitName(duName);
        when(deploymentUnit.getServiceName()).thenReturn(deploymentUnitServiceName);
        return deploymentUnit;
View Full Code Here

Examples of org.jboss.as.server.deployment.Attachable

            if(SubDeploymentMarker.isSubDeployment(resourceRoot) && resourceRoot != deploymentRoot) {
                continue;
            }
            // if this resource root represents an additional module then we need
            // to add the class path entry to the additional module
            final Attachable target;
            if (additionalModules.containsKey(resourceRoot.getRoot())) {
                target = additionalModules.get(resourceRoot.getRoot());
            } else {
                target = deploymentUnit;
            }
            final String[] items = getClassPathEntries(resourceRoot);
            for (String item : items) {
                final VirtualFile classPathFile = resourceRoot.getRoot().getParent().getChild(item);
                if (isInside(classPathFile, topLevelRoot)) {
                    if (earLibJars.contains(classPathFile)) {
                        log.debugf("Class-Path entry %s in %s ignored, as target is in or referenced by /lib", classPathFile,
                                resourceRoot.getRoot());
                        continue; // we already have access to ear/lib
                    } else if (additionalModules.containsKey(classPathFile)) {
                        target.addToAttachmentList(Attachments.CLASS_PATH_ENTRIES, additionalModules.get(classPathFile)
                                .getModuleIdentifier());
                    } else if (subDeploymentModules.containsKey(classPathFile)) {
                        target.addToAttachmentList(Attachments.CLASS_PATH_ENTRIES, subDeploymentModules.get(classPathFile));
                    } else {
                        log.warn("Class Path entry " + item + " in "
                                + resourceRoot.getRoot() + "  does not point to a valid jar for a Class-Path reference.");
                    }
                }  else if(item.startsWith("/")) {
                    ModuleIdentifier moduleIdentifier = externalModuleService.addExternalModule(item);
                    target.addToAttachmentList(Attachments.CLASS_PATH_ENTRIES, moduleIdentifier);
                    log.debugf("Resource %s added as external jar %s", classPathFile, resourceRoot.getRoot());
                } else {
                    //ignore
                    log.debugf("Ignoring missing Class-Path entry %s", classPathFile);
                }
View Full Code Here

Examples of org.jboss.as.server.deployment.Attachable

        //additional resource roots may be added as
        while (!resourceRoots.isEmpty()) {
            final RootEntry entry = resourceRoots.pop();
            final ResourceRoot resourceRoot = entry.resourceRoot;
            final Attachable target = entry.target;

            //if this is a top level deployment we do not want to process sub deployments
            if (SubDeploymentMarker.isSubDeployment(resourceRoot) && resourceRoot != deploymentRoot) {
                continue;
            }

            final String[] items = getClassPathEntries(resourceRoot);
            for (final String item : items) {
                if(item.isEmpty()) {
                    continue;
                }
                //first try and resolve relative to the manifest resource root
                final VirtualFile classPathFile = resourceRoot.getRoot().getParent().getChild(item);
                //then resolve relative to the deployment root
                final VirtualFile topLevelClassPathFile = deploymentRoot.getRoot().getParent().getChild(item);
                if (item.startsWith("/")) {
                    final ModuleIdentifier moduleIdentifier = externalModuleService.addExternalModule(item);
                    target.addToAttachmentList(Attachments.CLASS_PATH_ENTRIES, moduleIdentifier);
                    ServerLogger.DEPLOYMENT_LOGGER.debugf("Resource %s added as external jar %s", classPathFile, resourceRoot.getRoot());
                } else {
                    if (classPathFile.exists()) {
                        handlingExistingClassPathEntry(deploymentUnit, resourceRoots, topLevelDeployment, topLevelRoot, subDeployments, additionalModules, existingAccessibleRoots, resourceRoot, target, classPathFile);
                    } else if (topLevelClassPathFile.exists()) {
View Full Code Here

Examples of org.jboss.as.server.deployment.Attachable

            if (SubDeploymentMarker.isSubDeployment(resourceRoot) && resourceRoot != deploymentRoot) {
                continue;
            }
            // if this resource root represents an additional module then we need
            // to add the class path entry to the additional module
            final Attachable target;
            if (additionalModules.containsKey(resourceRoot.getRoot())) {
                target = additionalModules.get(resourceRoot.getRoot());
            } else {
                target = deploymentUnit;
            }
            final String[] items = getClassPathEntries(resourceRoot);
            for (String item : items) {
                //first try and resolve relative to the manifest resource root
                boolean found = false;
                final VirtualFile classPathFile = resourceRoot.getRoot().getParent().getChild(item);
                final VirtualFile topLevelClassPathFile = deploymentRoot.getRoot().getParent().getChild(item);
                if (isInside(classPathFile, topLevelRoot)) {
                    if (earLibJars.contains(classPathFile)) {
                        log.debugf("Class-Path entry %s in %s ignored, as target is in or referenced by /lib", classPathFile,
                                resourceRoot.getRoot());
                    } else if (additionalModules.containsKey(classPathFile)) {
                        target.addToAttachmentList(Attachments.CLASS_PATH_ENTRIES, additionalModules.get(classPathFile)
                                .getModuleIdentifier());
                    } else if (subDeploymentModules.containsKey(classPathFile)) {
                        target.addToAttachmentList(Attachments.CLASS_PATH_ENTRIES, subDeploymentModules.get(classPathFile));
                    } else if (additionalModules.containsKey(topLevelClassPathFile)) {
                        //if not found try resolving the class path entry from the deployment root
                        target.addToAttachmentList(Attachments.CLASS_PATH_ENTRIES, additionalModules.get(topLevelClassPathFile)
                                .getModuleIdentifier());
                    } else if (subDeploymentModules.containsKey(topLevelClassPathFile)) {
                        //if not found try resolving the class path entry from the deployment root
                        target.addToAttachmentList(Attachments.CLASS_PATH_ENTRIES, subDeploymentModules.get(topLevelClassPathFile));
                    } else if(classPathFile.exists() && classPathFile.isDirectory()) {

                    } else if(topLevelClassPathFile.exists() && topLevelClassPathFile.isDirectory()) {

                    } else {
                        log.warn("Class Path entry " + item + " in " + resourceRoot.getRoot() + "  does not point to a valid jar for a Class-Path reference.");
                    }
                } else if (item.startsWith("/")) {
                    ModuleIdentifier moduleIdentifier = externalModuleService.addExternalModule(item);
                    target.addToAttachmentList(Attachments.CLASS_PATH_ENTRIES, moduleIdentifier);
                    log.debugf("Resource %s added as external jar %s", classPathFile, resourceRoot.getRoot());
                } else {
                    //ignore
                    log.debugf("Ignoring missing Class-Path entry %s", classPathFile);
                }
View Full Code Here

Examples of org.jboss.as.server.deployment.Attachable

                    && !SubDeploymentMarker.isSubDeployment(resourceRoot)) {
                continue;
            }
            // if this resource root represents an additional module then we need
            // to add the class path entry to the additional module
            final Attachable target;
            if (additionalModules.containsKey(resourceRoot.getRoot())) {
                target = additionalModules.get(resourceRoot.getRoot());
            } else {
                target = deploymentUnit;
            }
            final String[] items = getClassPathEntries(resourceRoot);
            for (String item : items) {
                final VirtualFile classPathFile = resourceRoot.getRoot().getParent().getChild(item);
                if (isInside(classPathFile, topLevelRoot)) {
                    if (earLibJars.contains(classPathFile)) {
                        log.debugf("Class-Path entry %s in %s ignored, as target is in or referenced by /lib", classPathFile,
                                resourceRoot.getRoot());
                        continue; // we already have access to ear/lib
                    } else if(additionalModules.containsKey(classPathFile)) {
                        target.addToAttachmentList(Attachments.CLASS_PATH_ENTRIES, additionalModules.get(classPathFile)
                                .getModuleIdentifier());
                    } else {
                        log.warn("Class Path entry " + item + " in "
                                + resourceRoot.getRoot() + "  does not point to a valid jar for a Class-Path reference.");
                    }
                }  else if(item.startsWith("/")) {
                    ModuleIdentifier moduleIdentifier = externalModuleService.addExternalModule(item);
                    target.addToAttachmentList(Attachments.CLASS_PATH_ENTRIES, moduleIdentifier);
                    log.debugf("Resource %s added as external jar %s", classPathFile, resourceRoot.getRoot());
                } else {
                    //this is a dep on another deployment
                    target.addToAttachmentList(Attachments.CLASS_PATH_ENTRIES,ModuleIdentifier.create(ServiceModuleLoader.MODULE_PREFIX + classPathFile.getName()));
                }
            }
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.