Minetorio | Wiki
  • Introduction
    • Minetorio
  • User Guide / Tutorial
    • Devices
    • Movers
    • Logistics
    • Technology
    • Pollution
    • Biters
    • Videos
  • Commands & Permissions
    • Commands
    • Permissions
  • Configuration
    • Standard Configuration
    • Premium Configuration
    • Performance Configuration
    • Biter & Pollution Configuration
    • Plugin Support Configuration
  • Plugin Files
    • Config.yml
    • Server Data
  • DEVELOPERS
    • API / Setup
    • Example Usage
Powered by GitBook
On this page
  1. DEVELOPERS

Example Usage

Some basic examples of how to use the API

@EventHandler
public void onBreak(BlockBreakEvent event) {
    if(MTAPI.isDevice(event.getBlock().getLocation())){
        //do something
    }
}

@EventHandler
public void onBreak2(BlockBreakEvent event) {
    Device device = MTAPI.getDevice(event.getBlock().getLocation());
    if(device != null){
        event.getPlayer().damage(1.0); //do something
    }
}

@EventHandler
public void onBreak3(BlockBreakEvent event) {
    PlayerData playerData = MTAPI.getPlayerData(event.getPlayer().getUniqueId());
    if(playerData != null){
        if(playerData.hasTech("Steam Technology")){
            //do something
        }
    }
}

@EventHandler
public void onBreak4(BlockBreakEvent event) {
    PlayerData playerData = MTAPI.getPlayerData(event.getPlayer().getUniqueId());
    if(playerData != null){
        playerData.unlockTech("Steam Technology");
    }
}

@EventHandler
public void onBreak5(BlockBreakEvent event) {
    SuperChunk superChunk = MTAPI.getSuperChunk(event.getBlock().getLocation());
    if(superChunk != null){
        superChunk.addPollution(100);
        superChunk.setPollution(0);
        superChunk.setLifeSpanPollution(0);///Used for evolution %
        ArrayList<Chunk> chunks = superChunk.getChunks();//Get all chunks
    }
}
PreviousAPI / Setup

Last updated 5 months ago