Package org.bukkit.entity

Examples of org.bukkit.entity.Painting


    public static BukkitEntity toLocalEntity(Entity e) {
        switch (e.getType()) {
            case EXPERIENCE_ORB:
                return new BukkitExpOrb(toLocation(e.getLocation()), e.getUniqueId(), ((ExperienceOrb)e).getExperience());
            case PAINTING:
                Painting paint = (Painting) e;
                return new BukkitPainting(toLocation(e.getLocation()), paint.getArt(), paint.getFacing(), e.getUniqueId());
            case DROPPED_ITEM:
                return new BukkitItem(toLocation(e.getLocation()), ((Item)e).getItemStack(), e.getUniqueId());
            default:
                return new BukkitEntity(toLocation(e.getLocation()), e.getType(), e.getUniqueId());
        }
View Full Code Here


        return true;
    }

    public boolean spawnRaw(Location weLoc) {
        org.bukkit.Location loc = BukkitUtil.toLocation(weLoc);
        Painting paint = loc.getWorld().spawn(loc, Painting.class);
        if (paint != null) {
            paint.setFacingDirection(facingDirection, true);
            paint.setArt(art, true);
            return true;
        }
        return false;
    }
View Full Code Here

        switch (e.getType()) {
            case EXPERIENCE_ORB:
                return new BukkitExpOrb(toLocation(e.getLocation()), e.getUniqueId(),
                        ((ExperienceOrb) e).getExperience());
            case PAINTING:
                Painting paint = (Painting) e;
                return new BukkitPainting(toLocation(e.getLocation()), paint.getArt(), paint.getFacing(),
                        e.getUniqueId());
            case DROPPED_ITEM:
                return new BukkitItem(toLocation(e.getLocation()), ((Item) e).getItemStack(), e.getUniqueId());
            default:
                return new BukkitEntity(toLocation(e.getLocation()), e.getType(), e.getUniqueId());
View Full Code Here

        if(!EventUtil.passesFilter(event)) return;

        if (event.getRightClicked() instanceof Painting) {
            LocalPlayer player = CraftBookPlugin.inst().wrapPlayer(event.getPlayer());
            Painting paint = (Painting) event.getRightClicked();

            if(!player.hasPermission("craftbook.mech.paintingswitch.use")) {
                if(CraftBookPlugin.inst().getConfiguration().showPermissionMessages)
                    player.printError("mech.use-permissions");
                return;
            }

            if(!ProtectionUtil.canBuild(event.getPlayer(), paint.getLocation(), true)) {
                if(CraftBookPlugin.inst().getConfiguration().showPermissionMessages)
                    player.printError("area.use-permissions");
                return;
            }
View Full Code Here

            isForwards = false;
        } else if (event.getPreviousSlot() == 8 && event.getNewSlot() == 0) {
            isForwards = true;
        }
        Art[] art = Art.values().clone();
        Painting paint = players.get(player.getUniqueId());
        if(!LocationUtil.isWithinSphericalRadius(paint.getLocation(), event.getPlayer().getLocation(), 5)) {
            player.printError("mech.painting.range");
            Painting p = players.remove(event.getPlayer().getUniqueId());
            if (p != null) {
                paintings.remove(p);
            }

            return;
View Full Code Here

    }

    @EventHandler
    public void onQuit(PlayerQuitEvent event) {

        Painting p = players.remove(event.getPlayer().getUniqueId());
        if (p != null)
            paintings.remove(p);
    }
View Full Code Here

    public boolean replace(boolean shouldDrop)
    {

        try
        {
            Painting p = getWorld().spawn(location.getBlock().getRelative(hanging.getAttachedFace()).getLocation(), Painting.class);
            p.teleport(location);
            p.setFacingDirection(hanging.getFacing(), true);
            p.setArt(((Painting) hanging).getArt());
        } catch (IllegalArgumentException e)
        {
            return false;
        }
        return true;
View Full Code Here

    long start = System.currentTimeMillis();

    if (event instanceof PaintingBreakByEntityEvent) {
      PaintingBreakByEntityEvent evt = (PaintingBreakByEntityEvent) event;
      Painting painting = evt.getPainting();
      Object remover = evt.getRemover();
      WorldCoord worldCoord;
     
      try {
        TownyWorld townyWorld = TownyUniverse.getDataSource().getWorld(painting.getWorld().getName());
         
        if (!townyWorld.isUsingTowny())
          return;
       
        worldCoord = new WorldCoord(townyWorld, Coord.parseCoord(painting.getLocation()));
      } catch (NotRegisteredException e1) {
        //TownyMessaging.sendErrorMsg(player, TownySettings.getLangString("msg_err_not_configured"));
        event.setCancelled(true);
        return;
      }
     
      if (remover instanceof Player) {
        Player player = (Player) evt.getRemover();

        //Get destroy permissions (updates if none exist)
        boolean bDestroy = TownyUniverse.getCachePermissions().getCachePermission(player, painting.getLocation(), TownyPermission.ActionType.DESTROY);

        PlayerCache cache = plugin.getCache(player);
        cache.updateCoord(worldCoord);
        TownBlockStatus status = cache.getStatus();
        if (status == TownBlockStatus.UNCLAIMED_ZONE && TownyUniverse.getPermissionSource().hasWildOverride(worldCoord.getWorld(), player, painting.getEntityId(), TownyPermission.ActionType.DESTROY))
          return;
        if (!bDestroy)
          event.setCancelled(true);
        if (cache.hasBlockErrMsg())
          TownyMessaging.sendErrorMsg(player, cache.getBlockErrMsg());
View Full Code Here

    }

    long start = System.currentTimeMillis();

    Player player = event.getPlayer();
    Painting painting = event.getPainting();

    WorldCoord worldCoord;
    try {
      TownyWorld townyWorld = TownyUniverse.getDataSource().getWorld(painting.getWorld().getName());
     
      if (!townyWorld.isUsingTowny())
        return;
     
      worldCoord = new WorldCoord(townyWorld, Coord.parseCoord(painting.getLocation()));
    } catch (NotRegisteredException e1) {
      TownyMessaging.sendErrorMsg(player, TownySettings.getLangString("msg_err_not_configured"));
      event.setCancelled(true);
      return;
    }

    //Get build permissions (updates if none exist)
    boolean bBuild = TownyUniverse.getCachePermissions().getCachePermission(player, painting.getLocation(), TownyPermission.ActionType.BUILD);

    PlayerCache cache = plugin.getCache(player);
    TownBlockStatus status = cache.getStatus();

    if (status == TownBlockStatus.UNCLAIMED_ZONE && TownyUniverse.getPermissionSource().hasWildOverride(worldCoord.getWorld(), player, painting.getEntityId(), TownyPermission.ActionType.BUILD))
      return;

    if (!bBuild)
      event.setCancelled(true);
View Full Code Here

TOP

Related Classes of org.bukkit.entity.Painting

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.