Fix economy NPE

This commit is contained in:
Jesse Boyd 2016-06-20 00:52:05 +10:00
parent f5e7d08ace
commit ce7468e63a

View File

@ -3,6 +3,7 @@ package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.ConsolePlayer; import com.intellectualcrafters.plot.object.ConsolePlayer;
import com.intellectualcrafters.plot.object.Expression;
import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotArea; import com.intellectualcrafters.plot.object.PlotArea;
@ -158,8 +159,9 @@ public class MainCommand extends Command {
if (EconHandler.manager != null) { if (EconHandler.manager != null) {
PlotArea area = player.getApplicablePlotArea(); PlotArea area = player.getApplicablePlotArea();
if (area != null) { if (area != null) {
Double price = area.PRICES.get(cmd.getFullId()).evalute(0d); Expression<Double> priceEval = area.PRICES.get(cmd.getFullId());
if (price != null && EconHandler.manager.getMoney(player) < price) { Double price = priceEval != null ? priceEval.evalute(0d) : 0d;
if (price != 0d && EconHandler.manager.getMoney(player) < price) {
if (failure != null) { if (failure != null) {
failure.run(); failure.run();
} }