Add CachedVaults
Only writes vaults to file on server shutdown or player quit, rather than every inventory close event. Also caches for read() events.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package com.drtshock.playervaults.vaultmanagement;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class CachedVaultsMap extends HashMap<Integer, Inventory> {
|
||||
public void setCachedVault(int id, Inventory inventory){
|
||||
this.put(id, inventory);
|
||||
}
|
||||
|
||||
public Inventory getCachedVault(int id){
|
||||
return this.containsKey(id) ? this.get(id) : null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user