Minecraft DataManagerAPI mod 2026 download
logo
minecraft mod DataManagerAPI

DataManagerAPI

Game Version: CB 1.7.2-R0.3
Total Downloads: 2,094
Updated: May 4, 2014
Created: Dec 31, 2013
Download DataManagerAPIDownload Earlier Versions

Earlier Versions

Name Size Uploaded Game Version Downloads
DataManagerAPI_v1.1.6 release 76.28 KB May 4, 2014 CB 1.7.2-R0.3 684 download DataManagerAPI DataManagerAPI_v1.1.6 releaseDownload
DataManagerAPI_v1.1.5 release 70.59 KB Feb 28, 2014 CB 1.7.2-R0.3 227 download DataManagerAPI DataManagerAPI_v1.1.5 releaseDownload
DataManagerAPI_v1.1.4 release 71.39 KB Jan 22, 2014 CB 1.7.2-R0.2 318 download DataManagerAPI DataManagerAPI_v1.1.4 releaseDownload
DataManagerAPI_v1.1.3 release 71.40 KB Jan 20, 2014 CB 1.7.2-R0.2 274 download DataManagerAPI DataManagerAPI_v1.1.3 releaseDownload
DataManagerAPI_v1.1.1 release 71.05 KB Jan 17, 2014 CB 1.7.2-R0.2 212 download DataManagerAPI DataManagerAPI_v1.1.1 releaseDownload
DataManagerAPI_v1.1.0 release 70.70 KB Jan 6, 2014 CB 1.7.2-R0.2 218 download DataManagerAPI DataManagerAPI_v1.1.0 releaseDownload
DataManagerAPI_v1.0.0 release 69.38 KB Dec 31, 2013 CB 1.7.2-R0.2 161 download DataManagerAPI DataManagerAPI_v1.0.0 releaseDownload

Description

Share this:

DataManagerAPI

Overview

DataManagerAPI is a library for plugins that needs to save data that is associated with players (such as kills, deaths, wins of games and much more)! This plugin supports MySQL.

Installation , Commands and Permissions

API

The API is for developers who want to use features of this library. Read the following for more info!

  • https://github.com/louis1234567890987654321/dm-api/wiki/Using-DataManagers
  • https://github.com/louis1234567890987654321/dm-api/tree/master/DataManager-examples/MyKillCounter

Summary of API

  • Create 2 classes that extends Data and DataLoader
  • Use
    DataManager<[your data class name]>.generateDataManager("myPluginName",this,myDataLoader);
    

    to generate a new data manager for your plugin

  • Use
    DataManager.removeAndSaveDataManagers(this);
    

    to remove and save all your data.

  • The above functions are mostly used in onEnable and onDisable respectively
  • Use
    myDataManager.getData("some_player_name")
    

    to get data of a player.

Here is an example of an implementation of DataManagerAPI.
For a better example please read this.

public class MyPointsPlugin extends JavaPlugin{
    DataManager<XX> dm;
    public void onEnable(){
        XXLoader myLoader = new XXLoader();
        dm = DataManager<XX>.generateNewDataManager("MyPointsPlugin", this, myLoader);
    }

    public void onDisable(){
        DataManager.removeAndSaveDataManagers(this);
    }

    public boolean onCommand(CommandSender s,Command c,String lbl,String[]args){
        if(c.equalsIgnoreCase("points")){
            s.sendMessage("Points:"+dm.getData(s.getName()).points);
        }else if(c.equalsIgnoreCase("givepoints")){
            if(s.isOp()){
                XX data = DataManager.getData(args[0]);
                data.points=Integer.parseInt(args[1]);
                dm.forceSave(data);
            }
        }
    }
}

class XX extends Data{
    int points;
    XX(DataManager<XX>manager,Player p,JavaPlugin plug){super(manager,p,plug);
        points=0;
    }
    public void onSave(){
        set("points",points);
    }
}
class XXLoader extends DataLoader<XX>{
    @Override
    protected XX loadData(Player p, JavaPlugin plugin) {
        int points=getInt("points",0);
        XX data=new XX(getDataManager(),p,plugin);
        XX.points=points;
        return data;
    }

    @Override
    protected XX getNewData(Player p, JavaPlugin plugin) {
        return new XX(getDataManager(),p,plugin);
    }
}

Comments

Add a comment