@Command(
     aliases = {"/regen"},
     usage = "",
     desc = "Regenerates the contents of the selection",
     help =
         "Regenerates the contents of the current selection.\n"
             + "This command might affect things outside the selection,\n"
             + "if they are within the same chunk.",
     min = 0,
     max = 0)
 @CommandPermissions("worldedit.regen")
 @Logging(REGION)
 public void regenerateChunk(
     Player player, LocalSession session, EditSession editSession, @Selection Region region)
     throws WorldEditException {
   Mask mask = session.getMask();
   Mask sourceMask = session.getSourceMask();
   try {
     session.setMask((Mask) null);
     session.setSourceMask((Mask) null);
     player.getWorld().regenerate(region, editSession);
   } finally {
     session.setMask(mask);
     session.setSourceMask(mask);
   }
   BBC.COMMAND_REGEN.send(player);
 }
Exemplo n.º 2
0
  @Command(
      aliases = {"/regen"},
      usage = "",
      desc = "Regenerates the contents of the selection",
      min = 0,
      max = 0)
  @CommandPermissions("worldedit.regen")
  @Logging(REGION)
  public static void regenerateChunk(
      CommandContext args,
      WorldEdit we,
      LocalSession session,
      LocalPlayer player,
      EditSession editSession)
      throws WorldEditException {

    Region region = session.getSelection(player.getWorld());
    Mask mask = session.getMask();
    session.setMask(null);
    player.getWorld().regenerate(region, editSession);
    session.setMask(mask);
    player.print("Region regenerated.");
  }
Exemplo n.º 3
0
 public void removeMask(Player p) {
   LocalSession session = PlotMe.worldeditplugin.getSession(p);
   RegionMask mask = null;
   session.setMask(mask);
 }
Exemplo n.º 4
0
  public void setMask(Player p, Location l) {
    World w = p.getWorld();

    String id = PlotManager.getPlotId(l);

    Location bottom = null;
    Location top = null;

    LocalSession session = PlotMe.worldeditplugin.getSession(p);

    if (!id.equalsIgnoreCase("")) {
      Plot plot = PlotManager.getPlotById(p, id);

      if (plot != null && plot.isAllowed(p.getUniqueId())) {
        bottom = PlotManager.getPlotBottomLoc(w, id);
        top = PlotManager.getPlotTopLoc(w, id);

        BukkitPlayer player = PlotMe.worldeditplugin.wrapPlayer(p);
        LocalWorld world = player.getWorld();

        Vector pos1 = new Vector(bottom.getBlockX(), bottom.getBlockY(), bottom.getBlockZ());
        Vector pos2 = new Vector(top.getBlockX(), top.getBlockY(), top.getBlockZ());

        CuboidRegion cr = new CuboidRegion(world, pos1, pos2);

        RegionMask rm = new RegionMask(cr);

        session.setMask(rm);
        return;
      }
    }

    if (bottom == null || top == null) {
      bottom = new Location(w, 0, 0, 0);
      top = new Location(w, 0, 0, 0);
    }

    Object result = null;

    try {
      Class<? extends LocalSession> csession = session.getClass();
      Method method = csession.getMethod("getMask", (Class<?>[]) null);
      result = method.invoke(session, (Object[]) null);
    } catch (NoSuchMethodException e) {
      e.printStackTrace();
    } catch (SecurityException e) {
      e.printStackTrace();
    } catch (IllegalAccessException e) {
      e.printStackTrace();
    } catch (IllegalArgumentException e) {
      e.printStackTrace();
    } catch (InvocationTargetException e) {
      e.printStackTrace();
    }

    if (result == null) {
      BukkitPlayer player = PlotMe.worldeditplugin.wrapPlayer(p);
      LocalWorld world = player.getWorld();

      Vector pos1 = new Vector(bottom.getBlockX(), bottom.getBlockY(), bottom.getBlockZ());
      Vector pos2 = new Vector(top.getBlockX(), top.getBlockY(), top.getBlockZ());

      CuboidRegion cr = new CuboidRegion(world, pos1, pos2);

      RegionMask rm = new RegionMask(cr);

      session.setMask(rm);
    }
  }