title: Update 1.7 class to 1.12.2 spigot
body: <p>i am trying to update a 1.7 class to 1.12.2. i fixed some errors but i dont know how to fix the other errors. if anyone have a suggestion, i would be very very happy...</p>
  
  <p>The Class:</p>
  
  <pre><code>package de.beastsoup.utils.spigot.bo2;
  
  import java.io.BufferedReader;
  import java.io.File;
  import java.io.FileReader;
  import java.util.ArrayList;
  import java.util.HashSet;
  import java.util.List;
  
  import de.beastsoup.utils.spigot.BeastUtils;
  import net.minecraft.server.v1_12_R1.TileEntity;
  import org.bukkit.Bukkit;
  import org.bukkit.Location;
  import org.bukkit.Material;
  import org.bukkit.World;
  import org.bukkit.block.Block;
  import org.bukkit.craftbukkit.v1_12_R1.CraftWorld;
  import org.bukkit.scheduler.BukkitRunnable;
  
  public class BO2 {
  
  private Arena arena;
  
  public BO2() {
      this.arena = new Arena(this);
  }
  
  public Arena getArena() {
      return arena;
  }
  
  private static HashSet&lt;Location&gt; blocksForUpdate = new HashSet&lt;&gt;();
  
  public void addBlockUpdate(Location location) {
      blocksForUpdate.add(location);
  }
  
  public void startUpdate() {
      new BukkitRunnable() {
          @Override
          public void run() {
              if (!blocksForUpdate.isEmpty()) {
                  net.minecraft.server.v1_12_R1.World world = ((CraftWorld) Bukkit.getWorlds().get(0)).getHandle();
                  for (Location location : blocksForUpdate) {
                      world.notify(location.getBlockX(), location.getBlockY(), location.getBlockZ());
                  }
                  blocksForUpdate.clear();
              }
          }
      }.runTaskTimer(BeastUtils.getPlugin(BeastUtils.class), 1, 1);
  }
  
  /* Spawn BO2 */
  
  public List&lt;Block&gt; spawn(Location location, File file) {
      long time = System.currentTimeMillis();
      BufferedReader reader;
      ArrayList&lt;Block&gt; blocks = new ArrayList&lt;&gt;();
      try {
          reader = new BufferedReader(new FileReader(file));
          String line = null;
          while ((line = reader.readLine()) != null) {
              if (!line.contains(",") || !line.contains(":")) {
                  continue;
              }
              String[] parts = line.split(":");
              String[] coordinates = parts[0].split(",");
              String[] blockData = parts[1].split("\\.");
  
              setBlockFast(location.getWorld(), location.getBlockX() + Integer.valueOf(coordinates[0]), location.getBlockY() + Integer.valueOf(coordinates[2]), location.getBlockZ() + Integer.valueOf(coordinates[1]), Integer.valueOf(blockData[0]), blockData.length &gt; 1 ? Byte.valueOf(blockData[1]) : 0);
              blocks.add(location.getWorld().getBlockAt(location.getBlockX() + Integer.valueOf(coordinates[0]), location.getBlockY() + Integer.valueOf(coordinates[2]), location.getBlockZ() + Integer.valueOf(coordinates[1])));
          }
          reader.close();
      } catch (Exception e) {
          e.printStackTrace();
      }
      System.out.println("BO2 spawnada em " + (time - System.currentTimeMillis()) + "ms");
      return blocks;
  }
  
  /* Load BO2 file */
  
  public List&lt;FutureBlock&gt; load(Location location, File file) {
      BufferedReader reader;
      ArrayList&lt;FutureBlock&gt; blocks = new ArrayList&lt;&gt;();
      try {
          reader = new BufferedReader(new FileReader(file));
          String line = null;
          while ((line = reader.readLine()) != null) {
              if (!line.contains(",") || !line.contains(":")) {
                  continue;
              }
              String[] parts = line.split(":");
              String[] coordinates = parts[0].split(",");
              String[] blockData = parts[1].split("\\.");
              blocks.add(new FutureBlock(location.clone().add(Integer.valueOf(coordinates[0]), Integer.valueOf(coordinates[2]), Integer.valueOf(coordinates[1])), Integer.valueOf(blockData[0]), blockData.length &gt; 1 ? Byte.valueOf(blockData[1]) : 0));
          }
          reader.close();
      } catch (Exception e) {
          e.printStackTrace();
      }
      return blocks;
  }
  
  /* Set methods */
  
  public boolean setBlockFast(World world, int x, int y, int z, int blockId, byte data) {
      if (y &gt;= 255 || y &lt; 0) {
          return false;
      }
      net.minecraft.server.v1_12_R1.World w = ((CraftWorld) world).getHandle();
      net.minecraft.server.v1_12_R1.Chunk chunk = w.getChunkAt(x &gt;&gt; 4, z &gt;&gt; 4);
      boolean b = data(chunk, x &amp; 0x0f, y, z &amp; 0x0f, net.minecraft.server.v1_12_R1.Block.getById(blockId), data);
      addBlockUpdate(new Location(Bukkit.getWorlds().get(0), x, y, z));
      return b;
  }
  
  @SuppressWarnings("deprecation")
  public boolean setBlockFast(Location location, Material material, byte data) {
      return setBlockFast(location.getWorld(), location.getBlockX(), location.getBlockY(), location.getBlockZ(), material.getId(), data);
  }
  
  private boolean data(net.minecraft.server.v1_12_R1.Chunk that, int i, int j, int k, net.minecraft.server.v1_12_R1.Block block, int l) {
      int i1 = k &lt;&lt; 4 | i;
  
      if (j &gt;= that.b[i1] - 1) {
          that.b[i1] = -999;
      }
  
      int j1 = that.heightMap[i1];
      net.minecraft.server.v1_12_R1.Block block1 = that.getType(i, j, k);
      int k1 = that.getData(i, j, k);
  
      if (block1 == block &amp;&amp; k1 == l) {
          return false;
      } else {
          boolean flag = false;
          net.minecraft.server.v1_12_R1.ChunkSection chunksection = that.getSections()[j &gt;&gt; 4];
  
          if (chunksection == null) {
              if (block == net.minecraft.server.v1_12_R1.Blocks.AIR) {
                  return false;
              }
  
              chunksection = that.getSections()[j &gt;&gt; 4] = new net.minecraft.server.v1_12_R1.ChunkSection(j &gt;&gt; 4 &lt;&lt; 4, !that.world.worldProvider.g);
              flag = j &gt;= j1;
          }
  
          int l1 = that.locX * 16 + i;
          int i2 = that.locZ * 16 + k;
  
          if (!that.world.isStatic) {
              block1.f(that.world, l1, j, i2, k1);
          }
          if (!(block1 instanceof IContainer)) {
              chunksection.setTypeId(i, j &amp; 15, k, block);
          }
          if (!that.world.isStatic) {
              block1.remove(that.world, l1, j, i2, block1, k1);
          } else if (block1 instanceof IContainer &amp;&amp; block1 != block) {
              that.world.p(l1, j, i2);
          }
          if (block1 instanceof IContainer) {
              chunksection.setTypeId(i, j &amp; 15, k, block);
          }
          if (chunksection.getTypeId(i, j &amp; 15, k) != block) {
              return false;
          } else {
              chunksection.setData(i, j &amp; 15, k, l);
              if (flag) {
                  that.initLighting();
              }
              TileEntity tileentity;
  
              if (block1 instanceof IContainer) {
                  tileentity = that.e(i, j, k);
                  if (tileentity != null) {
                      tileentity.u();
                  }
              }
              if (!that.world.isStatic &amp;&amp; (!that.world.captureBlockStates || (block instanceof net.minecraft.server.v1_7_R4.BlockContainer))) {
                  block.onPlace(that.world, l1, j, i2);
              }
  
              if (block instanceof IContainer) {
                  if (that.getType(i, j, k) != block) {
                      return false;
                  }
                  tileentity = that.e(i, j, k);
                  if (tileentity == null) {
                      tileentity = ((IContainer) block).a(that.world, l);
                      that.world.setTileEntity(l1, j, i2, tileentity);
                  }
  
                  if (tileentity != null) {
                      tileentity.u();
                  }
              }
  
              that.n = true;
              return true;
          }
      }
  }
  
  /* FutureBlock Utils */
  
  public class FutureBlock {
      private Location location;
      private int id;
      private byte data;
  
      public FutureBlock(Location location, int id, byte data) {
          this.location = location;
          this.id = id;
          this.data = data;
      }
  
      public byte getData() {
          return data;
      }
  
      public Location getLocation() {
          return location;
      }
  
      public int getId() {
          return id;
      }
  
      @SuppressWarnings("deprecation")
      public void place() {
          location.getBlock().setTypeIdAndData(id, data, true);
      }
  }
  
  }
  </code></pre>
  
  <p>This Error i need fix now: <a href="https://gyazo.com/cb3176c9d879532adddfc5ce1edad2eb" rel="nofollow noreferrer">https://gyazo.com/cb3176c9d879532adddfc5ce1edad2eb</a> , <a href="https://gyazo.com/014047f5103fd1eaace121bc121fa8dc" rel="nofollow noreferrer">https://gyazo.com/014047f5103fd1eaace121bc121fa8dc</a> , <a href="https://gyazo.com/6b546cd147037a9deffad42e3b1ce1ef" rel="nofollow noreferrer">https://gyazo.com/6b546cd147037a9deffad42e3b1ce1ef</a></p>
  
  <p>if anyone know nms spigot 1.12.2 or something i would be happy</p>