Package org.spout.api.exception

Examples of org.spout.api.exception.CommandException


    World world = args.popWorld("world", source);
    args.assertCompletelyParsed();

    Sky sky = world.get(Sky.class);
    if (sky == null) {
      throw new CommandException("The sky for " + world.getName() + " is not available.");
    }
    sky.setTime(relative ? (sky.getTime() + time) : time);
    if (getEngine() instanceof Client) {
      source.sendMessage(plugin.getPrefix() + ChatStyle.GREEN + "You set "
          + ChatStyle.WHITE + world.getName() + ChatStyle.GREEN
View Full Code Here


    Player player = args.popPlayerOrMe("player", source);
    args.assertCompletelyParsed();

    Human human = player.get(Human.class);
    if (human == null) {
      throw new CommandException("Invalid player!");
    }

    human.setGamemode(mode);

    if (!player.equals(source)) {
View Full Code Here

    int amount = args.popInteger("amount");
    args.assertCompletelyParsed();

    Level level = player.get(Level.class);
    if (level == null) {
      throw new CommandException(player.getDisplayName() + " does not have experience.");
    }

    level.addExperience(amount);
    player.sendMessage(plugin.getPrefix() + ChatStyle.GREEN + "Your experience has been set to " + ChatStyle.WHITE + amount + ChatStyle.GREEN + ".");
  }
View Full Code Here

    World world = args.popWorld("world", source);
    args.assertCompletelyParsed();

    Sky sky = world.get(Sky.class);
    if (sky == null) {
      throw new CommandException("The sky of world '" + world.getName() + "' is not available.");
    }

    sky.setWeather(weather);
    String message;
    switch (weather) {
View Full Code Here

    Player player = args.popPlayerOrMe("player", source);
    args.assertCompletelyParsed();

    Health health = player.get(Health.class);
    if (health == null) {
      throw new CommandException(player.getDisplayName() + " can not be killed.");
    }
    health.kill(HealthChangeCause.COMMAND);
  }
View Full Code Here

  public void getBiomeName(CommandSource source, CommandArguments args) throws CommandException {
    args.assertCompletelyParsed();

    Player player = (Player) source;
    if (!(player.getPhysics().getPosition().getWorld().getGenerator() instanceof BiomeGenerator)) {
      throw new CommandException("This map does not appear to have any biome data.");
    }
    Point pos = player.getPhysics().getPosition();
    Biome biome = pos.getWorld().getBiome(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ());
    source.sendMessage(plugin.getPrefix() + ChatStyle.GREEN + "Current biome: " + ChatStyle.WHITE + (biome != null ? biome.getName() : "none"));
  }
View Full Code Here

TOP

Related Classes of org.spout.api.exception.CommandException

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.