@SuppressWarnings("deprecation")
  @Command(
      value = "myplanet",
      desc = "Erzeugt einen Testplaneten",
      perm = "craftoplugin.galaxywar.generate",
      onlyplayers = true)
  public void generatePlanet(final CommandSender cs, final String command, final String[] args) {
    final Player p = (Player) cs;
    p.sendMessage("Aktiv!");
    final int r = 6;
    PlanetType type = PlanetType.SUN;
    if (args.length > 0) {
      try {
        type = PlanetType.valueOf(args[0].toUpperCase());
      } catch (final IllegalArgumentException e) {
      }
    }
    final World world = p.getWorld();

    final Planet planet = new Planet(new Position(p.getLocation()), r, type);
    final ArrayList<MaterialBlockPoint> blocks = planet.getMaterialBlockPoints();

    Block block;
    for (final MaterialBlockPoint b : blocks) {
      block = world.getBlockAt(b.getX(), b.getY(), b.getZ());
      block.setType(b.getMaterial());
      block.setData((byte) 0);
    }
  }
Пример #2
0
 public void setPlanetType(PlanetType planetType) {
   this.put(PLANET_TYPE, planetType.name());
 }
Пример #3
0
 public PlanetType getPlanetType() {
   String type = (String) this.get(PLANET_TYPE);
   return PlanetType.valueOf(type);
 }