All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dev.the_fireplace.grandeconomy.nativeeconomy.AccountManager Maven / Gradle / Ivy

There is a newer version: 4.1.0+1.16.5
Show newest version
package dev.the_fireplace.grandeconomy.nativeeconomy;

import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;

public class AccountManager {
	private static final Map ACCOUNT_INSTANCES = new ConcurrentHashMap<>();

	public static BalanceTracker get(UUID accountId) {
	    return ACCOUNT_INSTANCES.computeIfAbsent(accountId, BalanceTracker::create);
	}

	public static boolean delete(UUID accountId) {
	    BalanceTracker account = ACCOUNT_INSTANCES.remove(accountId);
	    if (account != null) {
	        account.delete();
	        return true;
	    }

	    return false;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy