Developer API

Supreme does not provide a JavaDoc or a Maven/Gradle repo.

Environment Setup

Supreme Printer clients can download the API jar in #FAQ. Developers should ONLY have access to the API jar as everything required to use the API is included. Developers will NEVER need the real supremeprinter.jar to make addons. To import via Maven as a System dependency, use the following.

<dependency>
    <groupId>life.savav3</groupId>
    <artifactId>SupremePrinter</artifactId>
    <version>1.0.0</version>
    <scope>system</scope>
    <systemPath>${project.basedir}/dependencies/SupremePrinter.jar</systemPath>
</dependency>

Getting the Player Object

Player p = ...;

if (PrintingPlayers.getInstance().isPrintingPlayer(p)) {
  PrintingPlayer player = PrintingPlayers.getInstance().getByPlayer(p);
  ...
}

// Get all currently active printing players (online & offline)
List<PrintingPlayer> printers = PrintingPlayers.getInstance().getAllPrintingPlayers();

Printer Player Object

  PrintingPlayer player = ...;
  
  // Force a player to leave printer, and restore thier inventory.
  player.leavePrinterMode();
  
  // Take money for all current blocks (task does this normally)
  player.purchase();

Printer Events

@EventHandler
public void onPlayerEnterPrinter(PrinterEnterEvent e) {
    Player player = e.getPlayer(); // get the player entering printer mode
    
    if (...) e.setCancelled(true);
}

@EventHandler 
public void onPlayerLeavePrinter(PrinterLeaveEvent e) {
  Player player = e.getPlayer(); // get the player leaving printer mode
  ...
}

Last updated