Skip to content

Commit

Permalink
update API
Browse files Browse the repository at this point in the history
  • Loading branch information
StarchierOrb committed Sep 1, 2021
1 parent 5627085 commit 930411c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 5 deletions.
17 changes: 16 additions & 1 deletion src/main/java/me/starchier/inventorykeeper/InventoryKeeper.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.starchier.inventorykeeper;

import me.starchier.inventorykeeper.api.InvKeepAPI;
import me.starchier.inventorykeeper.bStats.MetricsLite;
import me.starchier.inventorykeeper.manager.DataManager;
import me.starchier.inventorykeeper.manager.PluginHandler;
Expand All @@ -18,9 +19,13 @@
import java.io.IOException;

public final class InventoryKeeper extends JavaPlugin {
public static boolean papiEnabled = false;
protected static boolean papiEnabled = false;
public static InventoryKeeper instance = null;
private InvKeepAPI api = null;

@Override
public void onEnable() {
instance = this;
PluginHandler ph = new PluginHandler(this);
MessagesUtil.initMessageBundle();
getLogger().info(MessagesUtil.getMessage("server-version") + PluginHandler.SERVER_VERSION + (PluginHandler.IS_LEGACY ? MessagesUtil.getMessage("is-legacy") : ""));
Expand Down Expand Up @@ -58,6 +63,7 @@ public void onEnable() {
getLogger().info(MessagesUtil.getMessage("init-player-data"));
DataManager dataManager = new DataManager(dataFile, ph);
dataManager.startupProcess();
api = new InvKeepAPI(dataManager);
getLogger().info(MessagesUtil.getMessage("init-commands"));
CommandInvKeep commandInvKeep = new CommandInvKeep(this, dataManager, ph, ih);
getCommand("invkeep").setExecutor(commandInvKeep);
Expand Down Expand Up @@ -89,4 +95,13 @@ public void onEnable() {
public void onDisable() {
// Plugin shutdown logic
}

public static InventoryKeeper getInstance() {
return instance;
}

public InvKeepAPI getAPI() {
return api;
}

}
15 changes: 15 additions & 0 deletions src/main/java/me/starchier/inventorykeeper/api/InvKeepAPI.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package me.starchier.inventorykeeper.api;

import me.starchier.inventorykeeper.manager.DataManager;

public class InvKeepAPI {
private final DataManager dataManager;

public InvKeepAPI(DataManager dataManager) {
this.dataManager = dataManager;
}

public DataManager getDataManager() {
return dataManager;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@
import me.starchier.inventorykeeper.items.ItemBase;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class PlayerStorage {
//Storage the death cause for player
Expand Down

0 comments on commit 930411c

Please sign in to comment.