Minecraft Puffinlump’s Data API mod 2024 download
logo
minecraft mod Puffinlump’s Data API

Puffinlump’s Data API

Game Version: 1.12
Total Downloads: 123
Updated: Jul 14, 2017
Created: Jul 14, 2017
Download Puffinlump’s Data APIDownload Earlier Versions

Earlier Versions

Name Size Uploaded Game Version Downloads
Puffinlump's Data API (Tester plugin) - Version 1.0 (Release) release 2.75 KB Jul 14, 2017 1.12 91 download Puffinlump’s Data API Puffinlump's Data API (Tester plugin) - Version 1.0 (Release) releaseDownload
Puffinlump's Data API - Version 1.1 (Alpha) alpha 31.35 KB Jul 14, 2017 1.12 26 download Puffinlump’s Data API Puffinlump's Data API - Version 1.1 (Alpha) alphaDownload

Description

Share this:

Hello Bukkit users! This is an API I've created to make saving and loading custom plugin data easily.

It makes it possible to save things like block metadata and such. This is my first plugin so expect it to have issues or over complications.

 

Getting Started

 Here is some example code:

import com.puffinlump.Data.*;

import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.Location;

// This is an example for getting started

// Keep in mind this would use 2 blocks with some metadata, CustomBlockType and CustomBlockName for example.

public class Main extends JavaPlugin {
	
	private Data data = null;
	
	public void onEnable() {
		data = new Data(); // Create the data handler
		data.RegisteredPlugin = this; // Register this to the data handler
		data.registerMetadata("CustomBlockType"); // Register some metadata
		data.registerMetadata("CustomBlockName"); // Register some more metadata
		data.load(); // You can supply a boolean to cause all saved blocks to be force loaded. If you load it at startup this won't be needed because the blocks will have the same data and id
		// NEVER LOAD BEFORE REGISTERING ANYTHING! This will cause it to either not load or break the API.
		Location loc = new Location(Bukkit.getWorlds().get(0), 0F, 50F, 0F); // The location of an example block. This is usually the overworld, but if for some reason it's not, figure out the world
		data.addBlock(loc.getBlock()); // Add a block to the data handler
		// When the plugin is disabled, the block will be saved. When it is enabled, it will have the registered metadatas.
	}
	
	public void onDisable() {
		data.onDisable(); // This is required for the plugin data to be saved!
	}
	
}

Things to keep in mind:

Do not load before registering stuff.

If the plugin has an error or is failing to load you can rename or delete the pluginData.PDAT file in server\plugins\The internal name of your plugin and post a link to the file here (E.g. through Dropbox) so that I can take a look at it and see if it's repairable.

Documentation

Incomplete, sorry about that!

Class List

[Main API Class] Data – The heart of the API

[Data Class] DataBlock – A class for saving blocks

[Data Class] DataItemMeta – A class for saving just item meta data. (Name, material etc.)

[Data Class] DataItemStack – A class for saving item stacks
[Data Class] DataLocation – A class for saving Bukkit locations

[Data Class] DataMetadataValue – A class for saving meta data values. (FixedMetadataValue etc.)

[System Class] DataObject – A class which all data classes extend
[System Class] Main – The main class of the plugin. Sort of self explainatory.

Note: Not all API functions are tested as of now! If you encounter an error, please notify me!

Comments

Add a comment