Package org.spout.api.generator

Examples of org.spout.api.generator.WorldGeneratorObject


  @CommandDescription (aliases = {"object", "obj"}, usage = "[-f] <object>", flags = {@Flag (aliases = {"force", "f"})},
      desc = "Spawn a WorldGeneratorObject at your location. Use -f to ignore canPlace check")
  @Filter (PlayerFilter.class)
  @Permissible ("vanilla.command.debug")
  public void generateObject(Player player, CommandArguments args) throws CommandException {
    final WorldGeneratorObject object = VanillaObjects.byName(args.currentArgument("object"));
    if (object == null) {
      throw args.failure("object", "Unknown object!", false);
    } else {
      args.success("object", object);
    }
    args.assertCompletelyParsed();

    final Point loc = player.getPhysics().getPosition();
    final World world = loc.getWorld();
    final int x = loc.getBlockX();
    final int y = loc.getBlockY();
    final int z = loc.getBlockZ();
    final boolean force = args.has("force");
    if (!object.canPlaceObject(world, x, y, z)) {
      player.sendMessage("Couldn't place the object.");
      if (!force) {
        return;
      }
      player.sendMessage("Forcing placement.");
    }
    object.placeObject(world, x, y, z);
    if (object instanceof RandomizableObject) {
      ((RandomizableObject) object).randomize();
    }
  }
View Full Code Here

TOP

Related Classes of org.spout.api.generator.WorldGeneratorObject

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.