Move the caching and static accessors from EconHandler to PlotMain

This commit is contained in:
MeFisto94
2020-06-24 17:33:49 +02:00
committed by Alexander Söderberg
parent 38425a1eae
commit 9c3d2cfb02
4 changed files with 25 additions and 12 deletions

View File

@ -174,11 +174,11 @@ public interface IPlotMain<P> extends ILogger {
boolean initWorldEdit();
/**
* Gets the economy provider.
* Gets the economy provider, if there is one
*
* @return the PlotSquared economy manager
*/
EconHandler getEconomyHandler();
@Nullable EconHandler getEconomyHandler();
/**
* Gets the {@link QueueProvider} class.

View File

@ -35,18 +35,17 @@ import org.jetbrains.annotations.Nullable;
public abstract class EconHandler {
/**
* @deprecated This will be made private in the future
* @deprecated This will be removed in the future,
* call {@link IPlotMain#getEconomyHandler()} instead.
*/
@Deprecated public static EconHandler manager;
@Deprecated @Nullable public static EconHandler manager;
/**
* Initialize the economy handler using
* {@link IPlotMain#getEconomyHandler()}
* Initialize the economy handler using {@link IPlotMain#getEconomyHandler()}
* @deprecated Call {@link #init} instead or use {@link IPlotMain#getEconomyHandler()}
* which does this already.
*/
public static void initializeEconHandler() {
if (manager != null) {
return;
}
@Deprecated public static void initializeEconHandler() {
manager = PlotSquared.get().IMP.getEconomyHandler();
}
@ -54,11 +53,15 @@ public abstract class EconHandler {
* Return the econ handler instance, if one exists
*
* @return Economy handler instance
* @deprecated Call {@link IPlotMain#getEconomyHandler()} instead
*/
@Nullable public static EconHandler getEconHandler() {
@Deprecated @Nullable public static EconHandler getEconHandler() {
manager = PlotSquared.get().IMP.getEconomyHandler();
return manager;
}
public abstract boolean init();
public double getMoney(PlotPlayer<?> player) {
if (player instanceof ConsolePlayer) {
return Double.MAX_VALUE;