mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
Replace null checks with NullEconHandler
This commit is contained in:
parent
551d1d9f1a
commit
311a2ddc75
@ -33,7 +33,6 @@ import com.plotsquared.core.inject.annotations.WorldConfig;
|
||||
import com.plotsquared.core.plot.BlockBucket;
|
||||
import com.plotsquared.core.plot.PlotId;
|
||||
import com.plotsquared.core.queue.GlobalBlockQueue;
|
||||
import com.plotsquared.core.util.EconHandler;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@ -63,12 +62,11 @@ public abstract class ClassicPlotWorld extends SquarePlotWorld {
|
||||
public ClassicPlotWorld(@Nonnull final String worldName,
|
||||
@Nullable final String id,
|
||||
@Nonnull final IndependentPlotGenerator generator,
|
||||
@Nonnull final PlotId min,
|
||||
@Nonnull final PlotId max,
|
||||
@Nullable final PlotId min,
|
||||
@Nullable final PlotId max,
|
||||
@WorldConfig @Nonnull final YamlConfiguration worldConfiguration,
|
||||
@Nonnull final GlobalBlockQueue blockQueue,
|
||||
@Nonnull final EconHandler econHandler) {
|
||||
super(worldName, id, generator, min, max, worldConfiguration, blockQueue, econHandler);
|
||||
@Nonnull final GlobalBlockQueue blockQueue) {
|
||||
super(worldName, id, generator, min, max, worldConfiguration, blockQueue);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -30,10 +30,8 @@ import com.plotsquared.core.inject.annotations.WorldConfig;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.plot.PlotId;
|
||||
import com.plotsquared.core.queue.GlobalBlockQueue;
|
||||
import com.plotsquared.core.util.EconHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public abstract class GridPlotWorld extends PlotArea {
|
||||
|
||||
@ -41,8 +39,7 @@ public abstract class GridPlotWorld extends PlotArea {
|
||||
|
||||
public GridPlotWorld(String worldName, String id, @Nonnull IndependentPlotGenerator generator,
|
||||
PlotId min, PlotId max, @WorldConfig @Nonnull final YamlConfiguration worldConfiguration,
|
||||
@Nonnull final GlobalBlockQueue blockQueue,
|
||||
@Nullable final EconHandler econHandler) {
|
||||
super(worldName, id, generator, min, max, worldConfiguration, blockQueue, econHandler);
|
||||
@Nonnull final GlobalBlockQueue blockQueue) {
|
||||
super(worldName, id, generator, min, max, worldConfiguration, blockQueue);
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,6 @@ import com.plotsquared.core.plot.PlotId;
|
||||
import com.plotsquared.core.plot.PlotManager;
|
||||
import com.plotsquared.core.plot.schematic.Schematic;
|
||||
import com.plotsquared.core.queue.GlobalBlockQueue;
|
||||
import com.plotsquared.core.util.EconHandler;
|
||||
import com.plotsquared.core.util.FileUtils;
|
||||
import com.plotsquared.core.util.MathMan;
|
||||
import com.plotsquared.core.util.SchematicHandler;
|
||||
@ -88,9 +87,8 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
||||
@Nullable @Assisted("min") final PlotId min,
|
||||
@Nullable @Assisted("max") final PlotId max,
|
||||
@WorldConfig @Nonnull final YamlConfiguration worldConfiguration,
|
||||
@Nonnull final GlobalBlockQueue blockQueue,
|
||||
@Nullable final EconHandler econHandler) {
|
||||
super(worldName, id, generator, min, max, worldConfiguration, blockQueue, econHandler);
|
||||
@Nonnull final GlobalBlockQueue blockQueue) {
|
||||
super(worldName, id, generator, min, max, worldConfiguration, blockQueue);
|
||||
PlotSquared.platform().getInjector().injectMembers(this);
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,6 @@ import com.plotsquared.core.configuration.file.YamlConfiguration;
|
||||
import com.plotsquared.core.inject.annotations.WorldConfig;
|
||||
import com.plotsquared.core.plot.PlotId;
|
||||
import com.plotsquared.core.queue.GlobalBlockQueue;
|
||||
import com.plotsquared.core.util.EconHandler;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -53,9 +52,8 @@ public abstract class SquarePlotWorld extends GridPlotWorld {
|
||||
@Nullable final PlotId min,
|
||||
@Nullable final PlotId max,
|
||||
@WorldConfig @Nonnull final YamlConfiguration worldConfiguration,
|
||||
@Nonnull final GlobalBlockQueue blockQueue,
|
||||
@Nullable final EconHandler econHandler) {
|
||||
super(worldName, id, generator, min, max, worldConfiguration, blockQueue, econHandler);
|
||||
@Nonnull final GlobalBlockQueue blockQueue) {
|
||||
super(worldName, id, generator, min, max, worldConfiguration, blockQueue);
|
||||
}
|
||||
|
||||
@Override public void loadConfiguration(ConfigurationSection config) {
|
||||
|
@ -40,7 +40,6 @@ import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.plot.PlotWeather;
|
||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||
import com.plotsquared.core.util.EconHandler;
|
||||
import com.plotsquared.core.util.EventDispatcher;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
@ -54,7 +53,6 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.UUID;
|
||||
|
||||
public class ConsolePlayer extends PlotPlayer<Actor> {
|
||||
@ -68,7 +66,6 @@ public class ConsolePlayer extends PlotPlayer<Actor> {
|
||||
@Inject private ConsolePlayer(@Nonnull final PlotAreaManager plotAreaManager,
|
||||
@Nonnull final EventDispatcher eventDispatcher,
|
||||
@ConsoleActor @Nonnull final Actor actor,
|
||||
@Nullable final EconHandler econHandler,
|
||||
@Nonnull final PermissionHandler permissionHandler) {
|
||||
super(plotAreaManager, eventDispatcher, permissionHandler);
|
||||
this.actor = actor;
|
||||
|
@ -27,8 +27,8 @@ package com.plotsquared.core.plot;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.collection.QuadMap;
|
||||
import com.plotsquared.core.configuration.ConfigurationNode;
|
||||
import com.plotsquared.core.configuration.ConfigurationSection;
|
||||
@ -57,7 +57,6 @@ import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
||||
import com.plotsquared.core.plot.flag.types.DoubleFlag;
|
||||
import com.plotsquared.core.queue.GlobalBlockQueue;
|
||||
import com.plotsquared.core.queue.QueueCoordinator;
|
||||
import com.plotsquared.core.util.EconHandler;
|
||||
import com.plotsquared.core.util.Expression;
|
||||
import com.plotsquared.core.util.MathMan;
|
||||
import com.plotsquared.core.util.RegionUtil;
|
||||
@ -154,14 +153,12 @@ public abstract class PlotArea {
|
||||
|
||||
private final YamlConfiguration worldConfiguration;
|
||||
private final GlobalBlockQueue globalBlockQueue;
|
||||
private final EconHandler econHandler;
|
||||
|
||||
public PlotArea(@Nonnull final String worldName, @Nullable final String id,
|
||||
@Nonnull IndependentPlotGenerator generator, @Nullable final PlotId min,
|
||||
@Nullable final PlotId max,
|
||||
@WorldConfig @Nullable final YamlConfiguration worldConfiguration,
|
||||
@Nonnull final GlobalBlockQueue blockQueue,
|
||||
@Nullable final EconHandler econHandler) {
|
||||
@Nonnull final GlobalBlockQueue blockQueue) {
|
||||
this.worldName = worldName;
|
||||
this.id = id;
|
||||
this.plotManager = createManager();
|
||||
@ -180,7 +177,6 @@ public abstract class PlotArea {
|
||||
}
|
||||
this.worldHash = worldName.hashCode();
|
||||
this.worldConfiguration = worldConfiguration;
|
||||
this.econHandler = econHandler;
|
||||
}
|
||||
|
||||
@Nonnull protected abstract PlotManager createManager();
|
||||
@ -305,7 +301,7 @@ public abstract class PlotArea {
|
||||
this.schematicClaimSpecify = config.getBoolean("schematic.specify_on_claim");
|
||||
this.schematics = new ArrayList<>(config.getStringList("schematic.schematics"));
|
||||
this.schematics.replaceAll(String::toLowerCase);
|
||||
this.useEconomy = config.getBoolean("economy.use") && this.econHandler != null;
|
||||
this.useEconomy = config.getBoolean("economy.use");
|
||||
ConfigurationSection priceSection = config.getConfigurationSection("economy.prices");
|
||||
if (this.useEconomy) {
|
||||
this.prices = new HashMap<>();
|
||||
|
@ -45,7 +45,6 @@ import com.plotsquared.core.plot.flag.FlagContainer;
|
||||
import com.plotsquared.core.queue.GlobalBlockQueue;
|
||||
import com.plotsquared.core.setup.PlotAreaBuilder;
|
||||
import com.plotsquared.core.setup.SettingsNodesWrapper;
|
||||
import com.plotsquared.core.util.EconHandler;
|
||||
import com.plotsquared.core.util.EventDispatcher;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
|
||||
@ -66,10 +65,9 @@ public class SinglePlotArea extends GridPlotWorld {
|
||||
@Nonnull final EventDispatcher eventDispatcher,
|
||||
@Nonnull final PlotListener plotListener,
|
||||
@WorldConfig @Nonnull final YamlConfiguration worldConfiguration,
|
||||
@Nonnull final GlobalBlockQueue globalBlockQueue,
|
||||
@Nonnull final EconHandler econHandler) {
|
||||
@Nonnull final GlobalBlockQueue globalBlockQueue) {
|
||||
super("*", null, new SingleWorldGenerator(plotAreaManager), null, null,
|
||||
worldConfiguration, globalBlockQueue, econHandler);
|
||||
worldConfiguration, globalBlockQueue);
|
||||
this.eventDispatcher = eventDispatcher;
|
||||
this.plotListener = plotListener;
|
||||
this.setAllowSigns(false);
|
||||
|
@ -34,7 +34,6 @@ import com.plotsquared.core.listener.PlotListener;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.queue.GlobalBlockQueue;
|
||||
import com.plotsquared.core.util.EconHandler;
|
||||
import com.plotsquared.core.util.EventDispatcher;
|
||||
import com.plotsquared.core.util.SetupUtils;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
@ -52,10 +51,9 @@ import javax.inject.Inject;
|
||||
@Inject public SinglePlotAreaManager(@Nonnull final EventDispatcher eventDispatcher,
|
||||
@Nonnull final PlotListener plotListener,
|
||||
@WorldConfig @Nonnull final YamlConfiguration worldConfiguration,
|
||||
@Nonnull final GlobalBlockQueue blockQueue,
|
||||
@Nonnull final EconHandler econHandler) {
|
||||
@Nonnull final GlobalBlockQueue blockQueue) {
|
||||
this.area = new SinglePlotArea(this, eventDispatcher, plotListener,
|
||||
worldConfiguration, blockQueue, econHandler);
|
||||
worldConfiguration, blockQueue);
|
||||
this.array = new SinglePlotArea[] {area};
|
||||
this.all = new PlotArea[] {area};
|
||||
SetupUtils.generators.put("PlotSquared:single",
|
||||
|
Loading…
Reference in New Issue
Block a user