BL
BlockStorage API
This api plugin allows you to store the data for each block in any coordinates in any chunk in separate files so that even after a server restart you can get your unique data for each block
package me.nome.BlockStorage;
import java.io.IOException;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin{
public static void main(String[] args) {
int chunkX=0;
int chunkZ=15;
//Create instance of ChunkContent(This instance save custom data for all blocks in this chunk)
ChunkContent chunk = new ChunkContent(chunkX,chunkZ);
int blockX=0;
int blockY=0;
int blockZ=0;
//Create instance of BlockContent(This instnace save custom data for block)
BlockContent blockContent = new BlockContent();
//With method set from BlockContent you can save custom data;
blockContent.set("myData", "myContent");
blockContent.set("private", true);
blockContent.set("counter", 0);
int block2X=0;
int block2Y=0;
int block2Z=1;
BlockContent blockContent2 = new BlockContent();
//With method set from BlockContent you can save custom data;
blockContent.set("myData", "myContent");
blockContent.set("private", true);
blockContent.set("counter", 0);
// Method addBlock save block custom data in current ChunkContent instance
chunk.addBlock(block2X, block2Y, block2Z, blockContent2);
/*
* Creates a file structure that specifies the path where the chunk file itself
* will be physically stored along with the written blocks and their data in them
* This instance describes a file that will be called x-z.bin where x and z are real coordinates of the chunk
*/
ChunkFile chunkFile= new ChunkFile("./",chunkX, chunkZ);
try {
//This method will create a file and write the chunk data to it
ChunkFileStorage.writeChunk(chunkFile, chunk);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
/*
* This method will read a chunk from a file
*/
ChunkContent readedChunkFromFile = ChunkFileStorage.readChunk(chunkFile);
} catch (ClassNotFoundException | IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//This method check if exists chunkFile
if(ChunkFileStorage.existsChunkFile(chunkFile)) {
}
}
}Similar projects
Plugin →Let Me Despawn
Improves performance by tweaking mob despawn rules. Say bye to pesky unintentional persistent mobs.
25MSueta
JourneyMap
Real-time map used for mapping in-game or your browser as you explore.
14.7MSueta
Emotecraft
Create your own emotes in Minecraft.
7.5MSueta
Simple Tpa
A simple tpa plugin which sends requests
5.4MSueta
Common Network
Forge and Fabric Unified Networking Solution
3.9MSueta
Set Home
A lightweight plugin for players to set their homes.
3.8MSueta