public void addChunkLoader(ChunkLoader chunkLoader) {
    Block block =
        getServer()
            .getWorld(chunkLoader.getWorld())
            .getBlockAt(chunkLoader.getX(), chunkLoader.getY(), chunkLoader.getZ());

    ChunkLoader existing =
        chunkLoaders.stream().filter(c -> c.getBlock().equals(block)).findFirst().orElse(null);

    if (existing != null) existing.delete();

    chunkLoader.setBlock(block);

    block.setType(getChunkLoaderMaterial(chunkLoader.getChunkType()));

    getChunkLoaders().add(chunkLoader);

    chunkLoader.load();

    data.saveChunkLoader(chunkLoader);

    Player player = getServer().getPlayer(chunkLoader.getOwner());
    if (player != null && player.isOnline())
      player.sendMessage(
          String.format(
              "%sSuccessfully placed %s chunk loader with and ID of %s and %s chunks",
              ChatColor.GOLD,
              chunkLoader.getChunkType(),
              chunkLoader.getId(),
              chunkLoader.getSize()));
  }
  public void deleteChunkLoader(ChunkLoader chunkLoader) {
    if (chunkLoader.isLoaded()) chunkLoader.delete();

    chunkLoader.getBlock().setType(Material.AIR);

    chunkLoaders.remove(chunkLoader);
    data.deleteChunkLoader(chunkLoader);
  }
 public ChunkLoader getChunkLoaderAtLocation(Location location) {
   String locationString =
       String.format(
           "%s:%s:%s:%s",
           location.getWorld().getName(),
           location.getBlockX(),
           location.getBlockY(),
           location.getBlockZ());
   return data.getChunkLoaderAtLocation(locationString);
 }
  public void updateChunkLoader(ChunkLoader chunkLoader) {
    data.saveChunkLoader(chunkLoader);

    Player player = getServer().getPlayer(chunkLoader.getOwner());
    if (player != null && player.isOnline())
      player.sendMessage(
          String.format(
              "%sSuccessfully updated your chunk loader. Chunks loaded are now %s",
              ChatColor.GOLD, chunkLoader.getSize()));
  }
  public void loadWorldChunks() {
    List<ChunkLoader> chunks = data.getWorldChunks();
    int chunkCount = 0;

    for (ChunkLoader cl : chunks) {
      if (!cl.load()) continue;

      chunkCount += cl.getSize();
      chunkLoaders.add(cl);
    }

    getLogger()
        .info(
            String.format(
                "Loaded %s world chunk loaders, totalling %s chunks", chunks.size(), chunkCount));
  }
  public void loadPersonalChunks(UUID uuid) {
    List<ChunkLoader> chunks = data.getPersonalChunks(uuid);
    int chunkCount = 0;

    for (ChunkLoader cl : chunks) {
      if (!cl.load()) continue;

      chunkCount += cl.getSize();
      getChunkLoaders().add(cl);
    }

    getLogger()
        .info(
            String.format(
                "Loaded %s personal chunk loaders, totalling %s chunks",
                chunks.size(), chunkCount));
  }
 public PlayerInfo getPlayerInfo(UUID uuid) {
   return data.getPlayerInfo(uuid);
 }
 public UUID getUUID(String name) {
   return data.getUUID(name);
 }
 public ChunkLoader getChunkLoader(int id) {
   return data.getChunkLoader(id);
 }
 public List<ChunkLoader> getPersonalChunks() {
   return data.getPersonalChunks();
 }
 public List<ChunkLoader> getPersonalChunks(String world) {
   return data.getPersonalChunks(world);
 }
 public List<ChunkLoader> getPersonalChunks(UUID uuid) {
   return data.getPersonalChunks(uuid);
 }
 public void updatePlayerInfo(PlayerInfo playerInfo) {
   data.updatePlayerInfo(playerInfo);
 }