Example #1
0
 @SuppressWarnings("deprecation")
 @Override
 protected void execute(Event e) {
   Location pos1 = location1.getSingle(e);
   Location pos2 = location2.getSingle(e);
   EditSession session = editSession.getSingle(e);
   ItemStack[] blocks = blockList.getAll(e);
   RandomPattern random = new RandomPattern();
   if (session == null) return;
   for (ItemStack b : blocks) {
     if (b.getType().isBlock()) {
       random.add(new BlockPattern(new BaseBlock(b.getTypeId(), b.getDurability())), 50);
     }
   }
   try {
     session.makeWalls(
         new CuboidRegion(
             (World) BukkitUtil.getLocalWorld(pos1.getWorld()),
             BukkitUtil.toVector(pos1),
             BukkitUtil.toVector(pos2)),
         Patterns.wrap(random));
     session.flushQueue();
   } catch (WorldEditException ex) {
     if (ex instanceof MaxChangedBlocksException) return;
     else ex.printStackTrace();
   }
 }
Example #2
0
 @Override
 protected void execute(Event event) {
   String u = url.getSingle(event);
   if (u == null) return;
   for (Player p : target.getAll(event)) {
     p.setResourcePack(u);
   }
 }