mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 02:04:44 +02:00
Finalize DI stuff
This commit is contained in:
@ -36,14 +36,16 @@ import com.plotsquared.core.location.World;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.queue.GlobalBlockQueue;
|
||||
import com.plotsquared.core.util.ChatManager;
|
||||
import com.plotsquared.core.util.ChunkManager;
|
||||
import com.plotsquared.core.util.EconHandler;
|
||||
import com.plotsquared.core.util.PlatformWorldManager;
|
||||
import com.plotsquared.core.util.PlayerManager;
|
||||
import com.plotsquared.core.util.RegionManager;
|
||||
import com.plotsquared.core.util.SetupUtils;
|
||||
import com.plotsquared.core.util.WorldUtil;
|
||||
import com.plotsquared.core.util.logger.ILogger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
@ -153,7 +155,7 @@ public interface PlotPlatform<P> extends ILogger {
|
||||
*
|
||||
* @return Default implementation generator
|
||||
*/
|
||||
@NotNull default IndependentPlotGenerator getDefaultGenerator() {
|
||||
@Nonnull default IndependentPlotGenerator getDefaultGenerator() {
|
||||
return getInjector().getInstance(Key.get(IndependentPlotGenerator.class, DefaultGenerator.class));
|
||||
}
|
||||
|
||||
@ -164,7 +166,7 @@ public interface PlotPlatform<P> extends ILogger {
|
||||
*
|
||||
* @return Backup manager
|
||||
*/
|
||||
@NotNull default BackupManager getBackupManager() {
|
||||
@Nonnull default BackupManager getBackupManager() {
|
||||
return getInjector().getInstance(BackupManager.class);
|
||||
}
|
||||
|
||||
@ -173,7 +175,7 @@ public interface PlotPlatform<P> extends ILogger {
|
||||
*
|
||||
* @return World manager
|
||||
*/
|
||||
@NotNull default PlatformWorldManager<?> getWorldManager() {
|
||||
@Nonnull default PlatformWorldManager<?> getWorldManager() {
|
||||
return getInjector().getInstance(PlatformWorldManager.class);
|
||||
}
|
||||
|
||||
@ -182,7 +184,7 @@ public interface PlotPlatform<P> extends ILogger {
|
||||
*
|
||||
* @return Player manager
|
||||
*/
|
||||
@NotNull default PlayerManager<? extends PlotPlayer<P>, ? extends P> getPlayerManager() {
|
||||
@Nonnull default PlayerManager<? extends PlotPlayer<P>, ? extends P> getPlayerManager() {
|
||||
return getInjector().getInstance(PlayerManager.class);
|
||||
}
|
||||
|
||||
@ -192,21 +194,21 @@ public interface PlotPlatform<P> extends ILogger {
|
||||
* @param worldName World name
|
||||
* @return Platform world wrapper
|
||||
*/
|
||||
@NotNull World<?> getPlatformWorld(@NotNull final String worldName);
|
||||
@Nonnull World<?> getPlatformWorld(@Nonnull final String worldName);
|
||||
|
||||
/**
|
||||
* Get the {@link com.google.inject.Injector} instance used by PlotSquared
|
||||
*
|
||||
* @return Injector instance
|
||||
*/
|
||||
@NotNull Injector getInjector();
|
||||
@Nonnull Injector getInjector();
|
||||
|
||||
/**
|
||||
* Get the world utility implementation
|
||||
*
|
||||
* @return World utility
|
||||
*/
|
||||
@NotNull default WorldUtil getWorldUtil() {
|
||||
@Nonnull default WorldUtil getWorldUtil() {
|
||||
return getInjector().getInstance(WorldUtil.class);
|
||||
}
|
||||
|
||||
@ -215,7 +217,7 @@ public interface PlotPlatform<P> extends ILogger {
|
||||
*
|
||||
* @return Global block queue implementation
|
||||
*/
|
||||
@NotNull default GlobalBlockQueue getGlobalBlockQueue() {
|
||||
@Nonnull default GlobalBlockQueue getGlobalBlockQueue() {
|
||||
return getInjector().getInstance(GlobalBlockQueue.class);
|
||||
}
|
||||
|
||||
@ -224,7 +226,7 @@ public interface PlotPlatform<P> extends ILogger {
|
||||
*
|
||||
* @return Hybrid utils
|
||||
*/
|
||||
@NotNull default HybridUtils getHybridUtils() {
|
||||
@Nonnull default HybridUtils getHybridUtils() {
|
||||
return getInjector().getInstance(HybridUtils.class);
|
||||
}
|
||||
|
||||
@ -233,17 +235,35 @@ public interface PlotPlatform<P> extends ILogger {
|
||||
*
|
||||
* @return Setup utils
|
||||
*/
|
||||
@NotNull default SetupUtils getSetupUtils() {
|
||||
@Nonnull default SetupUtils getSetupUtils() {
|
||||
return getInjector().getInstance(SetupUtils.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the {@link EconHandler} implementation for the platform
|
||||
*
|
||||
* *
|
||||
* @return Econ handler
|
||||
*/
|
||||
@NotNull default EconHandler getEconHandler() {
|
||||
@Nullable default EconHandler getEconHandler() {
|
||||
return getInjector().getInstance(EconHandler.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the {@link RegionManager} implementation for the platform
|
||||
*
|
||||
* @return Region manager
|
||||
*/
|
||||
@Nonnull default RegionManager getRegionManager() {
|
||||
return getInjector().getInstance(RegionManager.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the {@link ChunkManager} implementation for the platform
|
||||
*
|
||||
* @return Region manager
|
||||
*/
|
||||
@Nonnull default ChunkManager getChunkManager() {
|
||||
return getInjector().getInstance(ChunkManager.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,7 +26,6 @@
|
||||
package com.plotsquared.core;
|
||||
|
||||
import com.plotsquared.core.configuration.Caption;
|
||||
import com.plotsquared.core.configuration.CaptionUtility;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.configuration.ConfigurationSection;
|
||||
import com.plotsquared.core.configuration.ConfigurationUtil;
|
||||
@ -47,7 +46,6 @@ import com.plotsquared.core.generator.IndependentPlotGenerator;
|
||||
import com.plotsquared.core.inject.factory.HybridPlotWorldFactory;
|
||||
import com.plotsquared.core.listener.PlotListener;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.player.ConsolePlayer;
|
||||
import com.plotsquared.core.plot.BlockBucket;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
@ -56,13 +54,11 @@ import com.plotsquared.core.plot.PlotAreaType;
|
||||
import com.plotsquared.core.plot.PlotCluster;
|
||||
import com.plotsquared.core.plot.PlotId;
|
||||
import com.plotsquared.core.plot.PlotManager;
|
||||
import com.plotsquared.core.plot.comment.CommentManager;
|
||||
import com.plotsquared.core.plot.expiration.ExpireManager;
|
||||
import com.plotsquared.core.plot.expiration.ExpiryTask;
|
||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||
import com.plotsquared.core.plot.world.SinglePlotArea;
|
||||
import com.plotsquared.core.plot.world.SinglePlotAreaManager;
|
||||
import com.plotsquared.core.util.ChatManager;
|
||||
import com.plotsquared.core.util.EventDispatcher;
|
||||
import com.plotsquared.core.util.LegacyConverter;
|
||||
import com.plotsquared.core.util.MainUtil;
|
||||
@ -77,9 +73,9 @@ import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@ -150,7 +146,6 @@ public class PlotSquared {
|
||||
// Files and configuration
|
||||
@Getter private File jarFile = null; // This file
|
||||
private File storageFile;
|
||||
@Getter private PlotAreaManager plotAreaManager;
|
||||
@Getter private EventDispatcher eventDispatcher;
|
||||
@Getter private PlotListener plotListener;
|
||||
|
||||
@ -195,6 +190,7 @@ public class PlotSquared {
|
||||
if (!setupConfigs()) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.translationFile = MainUtil.getFile(this.platform.getDirectory(),
|
||||
Settings.Paths.TRANSLATIONS + File.separator + this.platform.getPluginName()
|
||||
+ ".use_THIS.yml");
|
||||
@ -207,29 +203,6 @@ public class PlotSquared {
|
||||
// Create plot listener
|
||||
this.plotListener = new PlotListener(this.eventDispatcher);
|
||||
|
||||
// Database
|
||||
if (Settings.Enabled_Components.DATABASE) {
|
||||
setupDatabase();
|
||||
}
|
||||
|
||||
// Check if we need to convert old flag values, etc
|
||||
if (!getConfigurationVersion().equalsIgnoreCase("v5")) {
|
||||
// Perform upgrade
|
||||
if (DBFunc.dbManager.convertFlags()) {
|
||||
log(Captions.PREFIX.getTranslated() + "Flags were converted successfully!");
|
||||
// Update the config version
|
||||
setConfigurationVersion("v5");
|
||||
}
|
||||
}
|
||||
|
||||
// Comments
|
||||
CommentManager.registerDefaultInboxes();
|
||||
|
||||
startExpiryTasks();
|
||||
|
||||
// This is getting removed so I won't even bother migrating it
|
||||
ChatManager.manager = this.platform.initChatManager();
|
||||
|
||||
// Copy files
|
||||
copyFile("addplots.js", Settings.Paths.SCRIPTS);
|
||||
copyFile("addsigns.js", Settings.Paths.SCRIPTS);
|
||||
@ -253,10 +226,15 @@ public class PlotSquared {
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
PlotSquared.log(Captions.PREFIX + CaptionUtility
|
||||
.format(ConsolePlayer.getConsole(), Captions.ENABLED.getTranslated(),
|
||||
this.platform.getPluginName()));
|
||||
/**
|
||||
* Get the platform specific {@link PlotAreaManager} instance
|
||||
*
|
||||
* @return Plot area manager
|
||||
*/
|
||||
@Nonnull public PlotAreaManager getPlotAreaManager() {
|
||||
return this.platform.getInjector().getInstance(PlotAreaManager.class);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -273,7 +251,7 @@ public class PlotSquared {
|
||||
*
|
||||
* @return Platform implementation
|
||||
*/
|
||||
@NotNull public static PlotPlatform<?> platform() {
|
||||
@Nonnull public static PlotPlatform<?> platform() {
|
||||
if (instance != null && instance.platform != null) {
|
||||
return instance.platform;
|
||||
}
|
||||
@ -315,12 +293,12 @@ public class PlotSquared {
|
||||
}
|
||||
}
|
||||
|
||||
private void startExpiryTasks() {
|
||||
public void startExpiryTasks() {
|
||||
if (Settings.Enabled_Components.PLOT_EXPIRY) {
|
||||
ExpireManager.IMP = new ExpireManager(this.eventDispatcher);
|
||||
ExpireManager.IMP.runAutomatedTask();
|
||||
for (Settings.Auto_Clear settings : Settings.AUTO_CLEAR.getInstances()) {
|
||||
ExpiryTask task = new ExpiryTask(settings, this.plotAreaManager);
|
||||
ExpiryTask task = new ExpiryTask(settings, this.getPlotAreaManager());
|
||||
ExpireManager.IMP.addTask(task);
|
||||
}
|
||||
}
|
||||
@ -412,7 +390,7 @@ public class PlotSquared {
|
||||
cluster.setArea(plotArea);
|
||||
}
|
||||
}
|
||||
plotAreaManager.addPlotArea(plotArea);
|
||||
getPlotAreaManager().addPlotArea(plotArea);
|
||||
plotArea.setupBorder();
|
||||
if (!Settings.Enabled_Components.PERSISTENT_ROAD_REGEN) {
|
||||
return;
|
||||
@ -459,11 +437,11 @@ public class PlotSquared {
|
||||
* @param area the {@code PlotArea} to remove
|
||||
*/
|
||||
public void removePlotArea(PlotArea area) {
|
||||
plotAreaManager.removePlotArea(area);
|
||||
getPlotAreaManager().removePlotArea(area);
|
||||
setPlotsTmp(area);
|
||||
}
|
||||
|
||||
public void removePlotAreas(@NotNull final String world) {
|
||||
public void removePlotAreas(@Nonnull final String world) {
|
||||
for (final PlotArea area : this.getPlotAreaManager().getPlotAreasSet(world)) {
|
||||
if (area.getWorldName().equals(world)) {
|
||||
removePlotArea(area);
|
||||
@ -486,7 +464,7 @@ public class PlotSquared {
|
||||
this.clustersTmp.put(area.toString(), area.getClusters());
|
||||
}
|
||||
|
||||
public Set<PlotCluster> getClusters(@NotNull final String world) {
|
||||
public Set<PlotCluster> getClusters(@Nonnull final String world) {
|
||||
final Set<PlotCluster> set = new HashSet<>();
|
||||
for (final PlotArea area : this.getPlotAreaManager().getPlotAreasSet(world)) {
|
||||
set.addAll(area.getClusters());
|
||||
@ -695,13 +673,13 @@ public class PlotSquared {
|
||||
// group by world
|
||||
// sort each
|
||||
HashMap<PlotArea, Collection<Plot>> map = new HashMap<>();
|
||||
int totalSize = Arrays.stream(this.plotAreaManager.getAllPlotAreas()).mapToInt(PlotArea::getPlotCount).sum();
|
||||
int totalSize = Arrays.stream(this.getPlotAreaManager().getAllPlotAreas()).mapToInt(PlotArea::getPlotCount).sum();
|
||||
if (plots.size() == totalSize) {
|
||||
for (PlotArea area : plotAreaManager.getAllPlotAreas()) {
|
||||
for (PlotArea area : getPlotAreaManager().getAllPlotAreas()) {
|
||||
map.put(area, area.getPlots());
|
||||
}
|
||||
} else {
|
||||
for (PlotArea area : plotAreaManager.getAllPlotAreas()) {
|
||||
for (PlotArea area : getPlotAreaManager().getAllPlotAreas()) {
|
||||
map.put(area, new ArrayList<>(0));
|
||||
}
|
||||
Collection<Plot> lastList = null;
|
||||
@ -716,7 +694,7 @@ public class PlotSquared {
|
||||
}
|
||||
}
|
||||
}
|
||||
List<PlotArea> areas = Arrays.asList(plotAreaManager.getAllPlotAreas());
|
||||
List<PlotArea> areas = Arrays.asList(getPlotAreaManager().getAllPlotAreas());
|
||||
areas.sort((a, b) -> {
|
||||
if (priorityArea != null) {
|
||||
if (a.equals(priorityArea)) {
|
||||
@ -749,7 +727,7 @@ public class PlotSquared {
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
public void setPlots(@NotNull final Map<String, HashMap<PlotId, Plot>> plots) {
|
||||
public void setPlots(@Nonnull final Map<String, HashMap<PlotId, Plot>> plots) {
|
||||
if (this.plots_tmp == null) {
|
||||
this.plots_tmp = new HashMap<>();
|
||||
}
|
||||
@ -816,7 +794,7 @@ public class PlotSquared {
|
||||
if (world.equals("CheckingPlotSquaredGenerator")) {
|
||||
return;
|
||||
}
|
||||
this.plotAreaManager.addWorld(world);
|
||||
this.getPlotAreaManager().addWorld(world);
|
||||
Set<String> worlds;
|
||||
if (this.worldConfiguration.contains("worlds")) {
|
||||
worlds = this.worldConfiguration.getConfigurationSection("worlds").getKeys(false);
|
||||
@ -832,7 +810,7 @@ public class PlotSquared {
|
||||
type = PlotAreaType.NORMAL;
|
||||
}
|
||||
if (type == PlotAreaType.NORMAL) {
|
||||
if (plotAreaManager.getPlotAreas(world, null).length != 0) {
|
||||
if (getPlotAreaManager().getPlotAreas(world, null).length != 0) {
|
||||
debug("World possibly already loaded: " + world);
|
||||
return;
|
||||
}
|
||||
@ -866,7 +844,7 @@ public class PlotSquared {
|
||||
.log(Captions.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + plotGenerator);
|
||||
PlotSquared.log(Captions.PREFIX + "&3 - plotworld: &7" + plotArea.getClass().getName());
|
||||
PlotSquared.log(
|
||||
Captions.PREFIX + "&3 - plotAreaManager: &7" + plotManager.getClass().getName());
|
||||
Captions.PREFIX + "&3 - getPlotAreaManager(): &7" + plotManager.getClass().getName());
|
||||
if (!this.worldConfiguration.contains(path)) {
|
||||
this.worldConfiguration.createSection(path);
|
||||
worldSection = this.worldConfiguration.getConfigurationSection(path);
|
||||
@ -887,7 +865,7 @@ public class PlotSquared {
|
||||
}
|
||||
ConfigurationSection areasSection = worldSection.getConfigurationSection("areas");
|
||||
if (areasSection == null) {
|
||||
if (plotAreaManager.getPlotAreas(world, null).length != 0) {
|
||||
if (getPlotAreaManager().getPlotAreas(world, null).length != 0) {
|
||||
debug("World possibly already loaded: " + world);
|
||||
return;
|
||||
}
|
||||
@ -954,7 +932,7 @@ public class PlotSquared {
|
||||
PlotSquared
|
||||
.log(Captions.PREFIX + "&3 - generator: &7" + baseGenerator + ">" + areaGen);
|
||||
PlotSquared.log(Captions.PREFIX + "&3 - plotworld: &7" + pa);
|
||||
PlotSquared.log(Captions.PREFIX + "&3 - plotAreaManager: &7" + pa.getPlotManager());
|
||||
PlotSquared.log(Captions.PREFIX + "&3 - getPlotAreaManager(): &7" + pa.getPlotManager());
|
||||
areaGen.getPlotGenerator().initialize(pa);
|
||||
areaGen.augment(pa);
|
||||
addPlotArea(pa);
|
||||
@ -1314,8 +1292,8 @@ public class PlotSquared {
|
||||
}
|
||||
DBFunc.dbManager = new SQLManager(database, Storage.PREFIX, this.eventDispatcher, this.plotListener, this.worldConfiguration);
|
||||
this.plots_tmp = DBFunc.getPlots();
|
||||
if (plotAreaManager instanceof SinglePlotAreaManager) {
|
||||
SinglePlotArea area = ((SinglePlotAreaManager) plotAreaManager).getArea();
|
||||
if (getPlotAreaManager() instanceof SinglePlotAreaManager) {
|
||||
SinglePlotArea area = ((SinglePlotAreaManager) getPlotAreaManager()).getArea();
|
||||
addPlotArea(area);
|
||||
ConfigurationSection section = worldConfiguration.getConfigurationSection("worlds.*");
|
||||
if (section == null) {
|
||||
@ -1556,7 +1534,7 @@ public class PlotSquared {
|
||||
}
|
||||
|
||||
public void forEachPlotRaw(Consumer<Plot> consumer) {
|
||||
for (final PlotArea area : this.plotAreaManager.getAllPlotAreas()) {
|
||||
for (final PlotArea area : this.getPlotAreaManager().getAllPlotAreas()) {
|
||||
area.getPlots().forEach(consumer);
|
||||
}
|
||||
if (this.plots_tmp != null) {
|
||||
@ -1573,10 +1551,10 @@ public class PlotSquared {
|
||||
* @param chunkCoordinates Chunk coordinates
|
||||
* @return True if the chunk uses non-standard generation, false if not
|
||||
*/
|
||||
public boolean isNonStandardGeneration(@NotNull final String world,
|
||||
@NotNull final BlockVector2 chunkCoordinates) {
|
||||
public boolean isNonStandardGeneration(@Nonnull final String world,
|
||||
@Nonnull final BlockVector2 chunkCoordinates) {
|
||||
final Location location = Location.at(world, chunkCoordinates.getBlockX() << 4, 64, chunkCoordinates.getBlockZ() << 4);
|
||||
final PlotArea area = plotAreaManager.getApplicablePlotArea(location);
|
||||
final PlotArea area = getPlotAreaManager().getApplicablePlotArea(location);
|
||||
if (area == null) {
|
||||
return true;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ package com.plotsquared.core.backup;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
|
@ -28,8 +28,8 @@ package com.plotsquared.core.backup;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.Objects;
|
||||
@ -45,7 +45,7 @@ public interface BackupManager {
|
||||
* @param plot Plot to perform the automatic backup on
|
||||
* @param whenDone Action that runs when the automatic backup has been completed
|
||||
*/
|
||||
static void backup(@Nullable PlotPlayer player, @NotNull final Plot plot, @NotNull Runnable whenDone) {
|
||||
static void backup(@Nullable PlotPlayer player, @Nonnull final Plot plot, @Nonnull Runnable whenDone) {
|
||||
Objects.requireNonNull(PlotSquared.platform()).getBackupManager().automaticBackup(player, plot, whenDone);
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ public interface BackupManager {
|
||||
* @param plot Plot to get the backup profile for
|
||||
* @return Backup profile
|
||||
*/
|
||||
@NotNull BackupProfile getProfile(@NotNull final Plot plot);
|
||||
@Nonnull BackupProfile getProfile(@Nonnull final Plot plot);
|
||||
|
||||
/**
|
||||
* This will perform an automatic backup of the plot iff the plot has an owner,
|
||||
@ -67,14 +67,14 @@ public interface BackupManager {
|
||||
* @param plot Plot to perform the automatic backup on
|
||||
* @param whenDone Action that runs when the automatic backup has been completed
|
||||
*/
|
||||
void automaticBackup(@Nullable PlotPlayer player, @NotNull final Plot plot, @NotNull Runnable whenDone);
|
||||
void automaticBackup(@Nullable PlotPlayer player, @Nonnull final Plot plot, @Nonnull Runnable whenDone);
|
||||
|
||||
/**
|
||||
* Get the directory in which backups are stored
|
||||
*
|
||||
* @return Backup directory path
|
||||
*/
|
||||
@NotNull Path getBackupPath();
|
||||
@Nonnull Path getBackupPath();
|
||||
|
||||
/**
|
||||
* Get the maximum amount of backups that may be stored for
|
||||
|
@ -25,7 +25,7 @@
|
||||
*/
|
||||
package com.plotsquared.core.backup;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
@ -38,7 +38,7 @@ public interface BackupProfile {
|
||||
*
|
||||
* @return Future that will be completed with available backups
|
||||
*/
|
||||
@NotNull CompletableFuture<List<Backup>> listBackups();
|
||||
@Nonnull CompletableFuture<List<Backup>> listBackups();
|
||||
|
||||
/**
|
||||
* Remove all backups stored for this profile
|
||||
@ -51,7 +51,7 @@ public interface BackupProfile {
|
||||
*
|
||||
* @return Folder that contains the backups for this profile
|
||||
*/
|
||||
@NotNull Path getBackupDirectory();
|
||||
@Nonnull Path getBackupDirectory();
|
||||
|
||||
/**
|
||||
* Create a backup of the plot. If the profile is at the
|
||||
@ -59,7 +59,7 @@ public interface BackupProfile {
|
||||
*
|
||||
* @return Future that completes with the created backup.
|
||||
*/
|
||||
@NotNull CompletableFuture<Backup> createBackup();
|
||||
@Nonnull CompletableFuture<Backup> createBackup();
|
||||
|
||||
/**
|
||||
* Restore a backup
|
||||
@ -67,6 +67,6 @@ public interface BackupProfile {
|
||||
* @param backup Backup to restore
|
||||
* @return Future that completes when the backup has finished
|
||||
*/
|
||||
@NotNull CompletableFuture<Void> restoreBackup(@NotNull final Backup backup);
|
||||
@Nonnull CompletableFuture<Void> restoreBackup(@Nonnull final Backup backup);
|
||||
|
||||
}
|
||||
|
@ -29,8 +29,8 @@ import com.google.inject.Singleton;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.Objects;
|
||||
@ -40,16 +40,16 @@ import java.util.Objects;
|
||||
*/
|
||||
@Singleton public class NullBackupManager implements BackupManager {
|
||||
|
||||
@Override @NotNull public BackupProfile getProfile(@NotNull Plot plot) {
|
||||
@Override @Nonnull public BackupProfile getProfile(@Nonnull Plot plot) {
|
||||
return new NullBackupProfile();
|
||||
}
|
||||
|
||||
@Override public void automaticBackup(@Nullable PlotPlayer plotPlayer,
|
||||
@NotNull Plot plot, @NotNull Runnable whenDone) {
|
||||
@Nonnull Plot plot, @Nonnull Runnable whenDone) {
|
||||
whenDone.run();
|
||||
}
|
||||
|
||||
@Override @NotNull public Path getBackupPath() {
|
||||
@Override @Nonnull public Path getBackupPath() {
|
||||
return Objects.requireNonNull(PlotSquared.platform()).getDirectory().toPath();
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
*/
|
||||
package com.plotsquared.core.backup;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
@ -39,22 +39,22 @@ import java.util.concurrent.CompletableFuture;
|
||||
*/
|
||||
public class NullBackupProfile implements BackupProfile {
|
||||
|
||||
@Override @NotNull public CompletableFuture<List<Backup>> listBackups() {
|
||||
@Override @Nonnull public CompletableFuture<List<Backup>> listBackups() {
|
||||
return CompletableFuture.completedFuture(Collections.emptyList());
|
||||
}
|
||||
|
||||
@Override public void destroy(){
|
||||
}
|
||||
|
||||
@Override @NotNull public Path getBackupDirectory() {
|
||||
@Override @Nonnull public Path getBackupDirectory() {
|
||||
return new File(".").toPath();
|
||||
}
|
||||
|
||||
@Override @NotNull public CompletableFuture<Backup> createBackup() {
|
||||
@Override @Nonnull public CompletableFuture<Backup> createBackup() {
|
||||
throw new UnsupportedOperationException("Cannot create backup of an unowned plot");
|
||||
}
|
||||
|
||||
@Override @NotNull public CompletableFuture<Void> restoreBackup(@NotNull final Backup backup) {
|
||||
@Override @Nonnull public CompletableFuture<Void> restoreBackup(@Nonnull final Backup backup) {
|
||||
return CompletableFuture.completedFuture(null);
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ import com.plotsquared.core.plot.schematic.Schematic;
|
||||
import com.plotsquared.core.util.SchematicHandler;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
@ -59,8 +59,8 @@ public class PlayerBackupProfile implements BackupProfile {
|
||||
private final BackupManager backupManager;
|
||||
private final SchematicHandler schematicHandler;
|
||||
|
||||
@Inject public PlayerBackupProfile(@Assisted @NotNull final UUID owner, @Assisted @NotNull final Plot plot,
|
||||
@NotNull final BackupManager backupManager, @NotNull final SchematicHandler schematicHandler) {
|
||||
@Inject public PlayerBackupProfile(@Assisted @Nonnull final UUID owner, @Assisted @Nonnull final Plot plot,
|
||||
@Nonnull final BackupManager backupManager, @Nonnull final SchematicHandler schematicHandler) {
|
||||
this.owner = owner;
|
||||
this.plot = plot;
|
||||
this.backupManager = backupManager;
|
||||
@ -70,12 +70,12 @@ public class PlayerBackupProfile implements BackupProfile {
|
||||
private volatile List<Backup> backupCache;
|
||||
private final Object backupLock = new Object();
|
||||
|
||||
private static boolean isValidFile(@NotNull final Path path) {
|
||||
private static boolean isValidFile(@Nonnull final Path path) {
|
||||
final String name = path.getFileName().toString();
|
||||
return name.endsWith(".schem") || name.endsWith(".schematic");
|
||||
}
|
||||
|
||||
@Override @NotNull public CompletableFuture<List<Backup>> listBackups() {
|
||||
@Override @Nonnull public CompletableFuture<List<Backup>> listBackups() {
|
||||
synchronized (this.backupLock) {
|
||||
if (this.backupCache != null) {
|
||||
return CompletableFuture.completedFuture(backupCache);
|
||||
@ -121,12 +121,12 @@ public class PlayerBackupProfile implements BackupProfile {
|
||||
});
|
||||
}
|
||||
|
||||
@NotNull public Path getBackupDirectory() {
|
||||
@Nonnull public Path getBackupDirectory() {
|
||||
return resolve(resolve(resolve(backupManager.getBackupPath(), Objects.requireNonNull(plot.getArea().toString(), "plot area id")),
|
||||
Objects.requireNonNull(plot.getId().toDashSeparatedString(), "plot id")), Objects.requireNonNull(owner.toString(), "owner"));
|
||||
}
|
||||
|
||||
private static Path resolve(@NotNull final Path parent, final String child) {
|
||||
private static Path resolve(@Nonnull final Path parent, final String child) {
|
||||
Path path = parent;
|
||||
try {
|
||||
if (!Files.exists(parent)) {
|
||||
@ -142,7 +142,7 @@ public class PlayerBackupProfile implements BackupProfile {
|
||||
return path;
|
||||
}
|
||||
|
||||
@Override @NotNull public CompletableFuture<Backup> createBackup() {
|
||||
@Override @Nonnull public CompletableFuture<Backup> createBackup() {
|
||||
final CompletableFuture<Backup> future = new CompletableFuture<>();
|
||||
this.listBackups().thenAcceptAsync(backups -> {
|
||||
synchronized (this.backupLock) {
|
||||
@ -162,7 +162,7 @@ public class PlayerBackupProfile implements BackupProfile {
|
||||
return future;
|
||||
}
|
||||
|
||||
@Override @NotNull public CompletableFuture<Void> restoreBackup(@NotNull final Backup backup) {
|
||||
@Override @Nonnull public CompletableFuture<Void> restoreBackup(@Nonnull final Backup backup) {
|
||||
final CompletableFuture<Void> future = new CompletableFuture<>();
|
||||
if (backup.getFile() == null || !Files.exists(backup.getFile())) {
|
||||
future.completeExceptionally(new IllegalArgumentException("The specific backup does not exist"));
|
||||
|
@ -39,8 +39,8 @@ import com.plotsquared.core.util.task.TaskManager;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
@ -60,7 +60,7 @@ import java.util.concurrent.TimeUnit;
|
||||
.expireAfterAccess(3, TimeUnit.MINUTES).build();
|
||||
private final PlayerBackupProfileFactory playerBackupProfileFactory;
|
||||
|
||||
@Inject public SimpleBackupManager(@NotNull final PlayerBackupProfileFactory playerBackupProfileFactory) throws Exception {
|
||||
@Inject public SimpleBackupManager(@Nonnull final PlayerBackupProfileFactory playerBackupProfileFactory) throws Exception {
|
||||
this.playerBackupProfileFactory = playerBackupProfileFactory;
|
||||
this.backupPath = Objects.requireNonNull(PlotSquared.platform()).getDirectory().toPath().resolve("backups");
|
||||
if (!Files.exists(backupPath)) {
|
||||
@ -70,7 +70,7 @@ import java.util.concurrent.TimeUnit;
|
||||
this.backupLimit = Settings.Backup.BACKUP_LIMIT;
|
||||
}
|
||||
|
||||
@Override @NotNull public BackupProfile getProfile(@NotNull final Plot plot) {
|
||||
@Override @Nonnull public BackupProfile getProfile(@Nonnull final Plot plot) {
|
||||
if (plot.hasOwner() && !plot.isMerged()) {
|
||||
try {
|
||||
return backupProfileCache.get(new PlotCacheKey(plot), () -> this.playerBackupProfileFactory.create(plot.getOwnerAbs(), plot));
|
||||
@ -83,7 +83,7 @@ import java.util.concurrent.TimeUnit;
|
||||
return new NullBackupProfile();
|
||||
}
|
||||
|
||||
@Override public void automaticBackup(@Nullable PlotPlayer player, @NotNull final Plot plot, @NotNull Runnable whenDone) {
|
||||
@Override public void automaticBackup(@Nullable PlotPlayer player, @Nonnull final Plot plot, @Nonnull Runnable whenDone) {
|
||||
final BackupProfile profile;
|
||||
if (!this.shouldAutomaticallyBackup() || (profile = getProfile(plot)) instanceof NullBackupProfile) {
|
||||
whenDone.run();
|
||||
|
@ -25,6 +25,7 @@
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.database.DBFunc;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
@ -35,7 +36,7 @@ import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.TabCompletions;
|
||||
import com.plotsquared.core.util.task.RunnableVal2;
|
||||
import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@ -54,7 +55,7 @@ public class Add extends Command {
|
||||
|
||||
private final EventDispatcher eventDispatcher;
|
||||
|
||||
public Add(@NotNull final EventDispatcher eventDispatcher) {
|
||||
@Inject public Add(@Nonnull final EventDispatcher eventDispatcher) {
|
||||
super(MainCommand.getInstance(), true);
|
||||
this.eventDispatcher = eventDispatcher;
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
@ -100,13 +100,13 @@ public class Area extends SubCommand {
|
||||
private final WorldUtil worldUtil;
|
||||
private final RegionManager regionManager;
|
||||
|
||||
@Inject public Area(@NotNull final PlotAreaManager plotAreaManager,
|
||||
@WorldConfig @NotNull final YamlConfiguration worldConfiguration,
|
||||
@WorldFile @NotNull final File worldFile,
|
||||
@NotNull final HybridPlotWorldFactory hybridPlotWorldFactory,
|
||||
@NotNull final SetupUtils setupUtils,
|
||||
@NotNull final WorldUtil worldUtil,
|
||||
@NotNull final RegionManager regionManager) {
|
||||
@Inject public Area(@Nonnull final PlotAreaManager plotAreaManager,
|
||||
@WorldConfig @Nonnull final YamlConfiguration worldConfiguration,
|
||||
@WorldFile @Nonnull final File worldFile,
|
||||
@Nonnull final HybridPlotWorldFactory hybridPlotWorldFactory,
|
||||
@Nonnull final SetupUtils setupUtils,
|
||||
@Nonnull final WorldUtil worldUtil,
|
||||
@Nonnull final RegionManager regionManager) {
|
||||
this.plotAreaManager = plotAreaManager;
|
||||
this.worldConfiguration = worldConfiguration;
|
||||
this.worldFile = worldFile;
|
||||
|
@ -26,6 +26,7 @@
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
import com.google.common.primitives.Ints;
|
||||
import com.google.inject.Inject;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.configuration.CaptionUtility;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
@ -49,8 +50,8 @@ import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.task.AutoClaimFinishTask;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Set;
|
||||
@ -66,10 +67,14 @@ public class Auto extends SubCommand {
|
||||
|
||||
private final PlotAreaManager plotAreaManager;
|
||||
private final EventDispatcher eventDispatcher;
|
||||
|
||||
public Auto(@NotNull final PlotAreaManager plotAreaManager, @NotNull final EventDispatcher eventDispatcher) {
|
||||
private final EconHandler econHandler;
|
||||
|
||||
@Inject public Auto(@Nonnull final PlotAreaManager plotAreaManager,
|
||||
@Nonnull final EventDispatcher eventDispatcher,
|
||||
@Nullable final EconHandler econHandler) {
|
||||
this.plotAreaManager = plotAreaManager;
|
||||
this.eventDispatcher = eventDispatcher;
|
||||
this.econHandler = econHandler;
|
||||
}
|
||||
|
||||
@Deprecated public static PlotId getNextPlotId(PlotId id, int step) {
|
||||
@ -147,7 +152,7 @@ public class Auto extends SubCommand {
|
||||
player.setMeta(Auto.class.getName(), true);
|
||||
autoClaimFromDatabase(player, area, start, new RunnableVal<Plot>() {
|
||||
@Override public void run(final Plot plot) {
|
||||
TaskManager.IMP.sync(new AutoClaimFinishTask(player, plot, area, schematic,
|
||||
TaskManager.getImplementation().sync(new AutoClaimFinishTask(player, plot, area, schematic,
|
||||
PlotSquared.get().getEventDispatcher()));
|
||||
}
|
||||
});
|
||||
@ -169,10 +174,9 @@ public class Auto extends SubCommand {
|
||||
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
||||
PlotArea plotarea = player.getApplicablePlotArea();
|
||||
if (plotarea == null) {
|
||||
if (EconHandler.getEconHandler() != null) {
|
||||
if (this.econHandler != null) {
|
||||
for (PlotArea area : this.plotAreaManager.getAllPlotAreas()) {
|
||||
if (EconHandler.getEconHandler()
|
||||
.hasPermission(area.getWorldName(), player.getName(), "plots.auto")) {
|
||||
if (this.econHandler.hasPermission(area.getWorldName(), player.getName(), "plots.auto")) {
|
||||
if (plotarea != null) {
|
||||
plotarea = null;
|
||||
break;
|
||||
@ -265,18 +269,18 @@ public class Auto extends SubCommand {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (EconHandler.getEconHandler() != null && plotarea.useEconomy()) {
|
||||
if (this.econHandler != null && plotarea.useEconomy()) {
|
||||
Expression<Double> costExp = plotarea.getPrices().get("claim");
|
||||
double cost = costExp.evaluate((double) (Settings.Limit.GLOBAL ?
|
||||
player.getPlotCount() :
|
||||
player.getPlotCount(plotarea.getWorldName())));
|
||||
cost = (size_x * size_z) * cost;
|
||||
if (cost > 0d) {
|
||||
if (!force && EconHandler.getEconHandler().getMoney(player) < cost) {
|
||||
if (!force && this.econHandler.getMoney(player) < cost) {
|
||||
sendMessage(player, Captions.CANNOT_AFFORD_PLOT, "" + cost);
|
||||
return true;
|
||||
}
|
||||
EconHandler.getEconHandler().withdrawMoney(player, cost);
|
||||
this.econHandler.withdrawMoney(player, cost);
|
||||
sendMessage(player, Captions.REMOVED_BALANCE, cost + "");
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.task.RunnableVal2;
|
||||
import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.time.Instant;
|
||||
@ -64,7 +64,7 @@ public final class Backup extends Command {
|
||||
|
||||
private final BackupManager backupManager;
|
||||
|
||||
@Inject public Backup(@NotNull final BackupManager backupManager) {
|
||||
@Inject public Backup(@Nonnull final BackupManager backupManager) {
|
||||
super(MainCommand.getInstance(), true);
|
||||
this.backupManager = backupManager;
|
||||
}
|
||||
|
@ -39,9 +39,9 @@ import com.plotsquared.core.util.EventDispatcher;
|
||||
import com.plotsquared.core.util.MainUtil;
|
||||
import com.plotsquared.core.util.task.RunnableVal2;
|
||||
import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@ -56,7 +56,7 @@ public class Buy extends Command {
|
||||
private final EventDispatcher eventDispatcher;
|
||||
private final EconHandler econHandler;
|
||||
|
||||
@Inject public Buy(@NotNull final EventDispatcher eventDispatcher,
|
||||
@Inject public Buy(@Nonnull final EventDispatcher eventDispatcher,
|
||||
@Nullable final EconHandler econHandler) {
|
||||
super(MainCommand.getInstance(), true);
|
||||
this.eventDispatcher = eventDispatcher;
|
||||
|
@ -71,7 +71,7 @@ public class Caps extends SubCommand {
|
||||
}
|
||||
|
||||
private <T extends PlotFlag<Integer, T>> void sendFormatted(final Plot plot,
|
||||
final PlotPlayer player, final Class<T> capFlag, final int[] countedEntities,
|
||||
final PlotPlayer<?> player, final Class<T> capFlag, final int[] countedEntities,
|
||||
final String name, final int type) {
|
||||
final int current = countedEntities[type];
|
||||
final int max = plot.getFlag(capFlag);
|
||||
|
@ -46,8 +46,8 @@ import com.plotsquared.core.util.Expression;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@CommandDeclaration(command = "claim",
|
||||
aliases = "c",
|
||||
@ -61,7 +61,7 @@ public class Claim extends SubCommand {
|
||||
private final EventDispatcher eventDispatcher;
|
||||
private final EconHandler econHandler;
|
||||
|
||||
@Inject public Claim(@NotNull final EventDispatcher eventDispatcher,
|
||||
@Inject public Claim(@Nonnull final EventDispatcher eventDispatcher,
|
||||
@Nullable final EconHandler econHandler) {
|
||||
this.eventDispatcher = eventDispatcher;
|
||||
this.econHandler = econHandler;
|
||||
|
@ -42,7 +42,7 @@ import com.plotsquared.core.util.MainUtil;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.task.RunnableVal2;
|
||||
import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@ -61,8 +61,8 @@ public class Clear extends Command {
|
||||
private final EventDispatcher eventDispatcher;
|
||||
private final GlobalBlockQueue blockQueue;
|
||||
|
||||
@Inject public Clear(@NotNull final EventDispatcher eventDispatcher,
|
||||
@NotNull final GlobalBlockQueue blockQueue) {
|
||||
@Inject public Clear(@Nonnull final EventDispatcher eventDispatcher,
|
||||
@Nonnull final GlobalBlockQueue blockQueue) {
|
||||
super(MainCommand.getInstance(), true);
|
||||
this.eventDispatcher = eventDispatcher;
|
||||
this.blockQueue = blockQueue;
|
||||
|
@ -36,7 +36,7 @@ import com.plotsquared.core.util.StringMan;
|
||||
import com.plotsquared.core.util.task.RunnableVal2;
|
||||
import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import lombok.SneakyThrows;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
@ -582,7 +582,7 @@ public abstract class Command {
|
||||
return object;
|
||||
}
|
||||
|
||||
@SneakyThrows protected static void sneakyThrow(@NotNull final Throwable throwable) {
|
||||
@SneakyThrows protected static void sneakyThrow(@Nonnull final Throwable throwable) {
|
||||
throw throwable;
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
@ -34,7 +35,7 @@ import com.plotsquared.core.util.MainUtil;
|
||||
import com.plotsquared.core.util.MathMan;
|
||||
import com.plotsquared.core.util.WorldUtil;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@ -56,9 +57,12 @@ public class Condense extends SubCommand {
|
||||
public static boolean TASK = false;
|
||||
|
||||
private final PlotAreaManager plotAreaManager;
|
||||
private final WorldUtil worldUtil;
|
||||
|
||||
public Condense(@NotNull final PlotAreaManager plotAreaManager) {
|
||||
@Inject public Condense(@Nonnull final PlotAreaManager plotAreaManager,
|
||||
@Nonnull final WorldUtil worldUtil) {
|
||||
this.plotAreaManager = plotAreaManager;
|
||||
this.worldUtil = worldUtil;
|
||||
}
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
||||
@ -67,7 +71,7 @@ public class Condense extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
PlotArea area = this.plotAreaManager.getPlotAreaByString(args[0]);
|
||||
if (area == null || !WorldUtil.IMP.isWorld(area.getWorldName())) {
|
||||
if (area == null || !this.worldUtil.isWorld(area.getWorldName())) {
|
||||
MainUtil.sendMessage(player, "INVALID AREA");
|
||||
return false;
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
import com.plotsquared.core.events.PlotFlagRemoveEvent;
|
||||
@ -36,7 +37,7 @@ import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
||||
import com.plotsquared.core.util.EventDispatcher;
|
||||
import com.plotsquared.core.util.MainUtil;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@CommandDeclaration(command = "continue",
|
||||
description = "Continue a plot that was previously marked as done",
|
||||
@ -47,7 +48,7 @@ public class Continue extends SubCommand {
|
||||
|
||||
private final EventDispatcher eventDispatcher;
|
||||
|
||||
public Continue(@NotNull final EventDispatcher eventDispatcher) {
|
||||
@Inject public Continue(@Nonnull final EventDispatcher eventDispatcher) {
|
||||
this.eventDispatcher = eventDispatcher;
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.util.MainUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@CommandDeclaration(command = "createroadschematic",
|
||||
aliases = {"crs"},
|
||||
@ -46,7 +46,7 @@ public class CreateRoadSchematic extends SubCommand {
|
||||
|
||||
private final HybridUtils hybridUtils;
|
||||
|
||||
@Inject public CreateRoadSchematic(@NotNull final HybridUtils hybridUtils) {
|
||||
@Inject public CreateRoadSchematic(@Nonnull final HybridUtils hybridUtils) {
|
||||
this.hybridUtils = hybridUtils;
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.inject.annotations.WorldConfig;
|
||||
import com.plotsquared.core.configuration.file.YamlConfiguration;
|
||||
@ -44,7 +45,7 @@ import com.plotsquared.core.util.EventDispatcher;
|
||||
import com.plotsquared.core.util.MainUtil;
|
||||
import com.plotsquared.core.util.query.PlotQuery;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.io.File;
|
||||
import java.sql.SQLException;
|
||||
@ -68,8 +69,10 @@ public class DatabaseCommand extends SubCommand {
|
||||
private final PlotListener plotListener;
|
||||
private final YamlConfiguration worldConfiguration;
|
||||
|
||||
public DatabaseCommand(@NotNull final PlotAreaManager plotAreaManager, @NotNull final EventDispatcher eventDispatcher,
|
||||
@NotNull final PlotListener plotListener, @WorldConfig @NotNull final YamlConfiguration worldConfiguration) {
|
||||
@Inject public DatabaseCommand(@Nonnull final PlotAreaManager plotAreaManager,
|
||||
@Nonnull final EventDispatcher eventDispatcher,
|
||||
@Nonnull final PlotListener plotListener,
|
||||
@WorldConfig @Nonnull final YamlConfiguration worldConfiguration) {
|
||||
this.plotAreaManager = plotAreaManager;
|
||||
this.eventDispatcher = eventDispatcher;
|
||||
this.plotListener = plotListener;
|
||||
|
@ -25,6 +25,7 @@
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
@ -38,7 +39,7 @@ import com.plotsquared.core.util.query.PlotQuery;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import com.plotsquared.core.uuid.UUIDMapping;
|
||||
import com.sk89q.worldedit.world.entity.EntityType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
@ -52,9 +53,12 @@ import java.util.Map;
|
||||
public class Debug extends SubCommand {
|
||||
|
||||
private final PlotAreaManager plotAreaManager;
|
||||
private final RegionManager regionManager;
|
||||
|
||||
public Debug(@NotNull final PlotAreaManager plotAreaManager) {
|
||||
@Inject public Debug(@Nonnull final PlotAreaManager plotAreaManager,
|
||||
@Nonnull final RegionManager regionManager) {
|
||||
this.plotAreaManager = plotAreaManager;
|
||||
this.regionManager = regionManager;
|
||||
}
|
||||
|
||||
@Override public boolean onCommand(PlotPlayer<?> player, String[] args) {
|
||||
@ -70,8 +74,7 @@ public class Debug extends SubCommand {
|
||||
final long start = System.currentTimeMillis();
|
||||
MainUtil.sendMessage(player, "Fetching loaded chunks...");
|
||||
TaskManager.runTaskAsync(() -> MainUtil.sendMessage(player,
|
||||
"Loaded chunks: " + RegionManager.manager
|
||||
.getChunkChunks(player.getLocation().getWorldName()).size() + "(" + (
|
||||
"Loaded chunks: " + this.regionManager.getChunkChunks(player.getLocation().getWorldName()).size() + "(" + (
|
||||
System.currentTimeMillis() - start) + "ms) using thread: " + Thread
|
||||
.currentThread().getName()));
|
||||
return true;
|
||||
|
@ -26,6 +26,7 @@
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
import com.google.common.io.Files;
|
||||
import com.google.inject.Inject;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
@ -62,8 +63,8 @@ import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import javax.script.Bindings;
|
||||
import javax.script.ScriptContext;
|
||||
@ -90,35 +91,39 @@ public class DebugExec extends SubCommand {
|
||||
private final PlotAreaManager plotAreaManager;
|
||||
private final EventDispatcher eventDispatcher;
|
||||
private final WorldEdit worldEdit;
|
||||
private final GlobalBlockQueue blockQueue;
|
||||
private final SchematicHandler schematicHandler;
|
||||
private final EconHandler econHandler;
|
||||
private final ChunkManager chunkManager;
|
||||
private final WorldUtil worldUtil;
|
||||
private final SetupUtils setupUtils;
|
||||
private final HybridUtils hybridUtils;
|
||||
|
||||
private ScriptEngine engine;
|
||||
private Bindings scope;
|
||||
|
||||
public DebugExec(@NotNull final PlotAreaManager plotAreaManager, @NotNull final EventDispatcher eventDispatcher,
|
||||
@Nullable final WorldEdit worldEdit) {
|
||||
@Inject public DebugExec(@Nonnull final PlotAreaManager plotAreaManager,
|
||||
@Nonnull final EventDispatcher eventDispatcher,
|
||||
@Nullable final WorldEdit worldEdit,
|
||||
@Nonnull final GlobalBlockQueue blockQueue,
|
||||
@Nonnull final SchematicHandler schematicHandler,
|
||||
@Nullable final EconHandler econHandler,
|
||||
@Nonnull final ChunkManager chunkManager,
|
||||
@Nonnull final WorldUtil worldUtil,
|
||||
@Nonnull final SetupUtils setupUtils,
|
||||
@Nonnull final HybridUtils hybridUtils) {
|
||||
this.plotAreaManager = plotAreaManager;
|
||||
this.eventDispatcher = eventDispatcher;
|
||||
this.worldEdit = worldEdit;
|
||||
this.blockQueue = blockQueue;
|
||||
this.schematicHandler = schematicHandler;
|
||||
this.econHandler = econHandler;
|
||||
this.chunkManager = chunkManager;
|
||||
this.worldUtil = worldUtil;
|
||||
this.setupUtils = setupUtils;
|
||||
this.hybridUtils = hybridUtils;
|
||||
|
||||
init();
|
||||
/*
|
||||
try {
|
||||
if (PlotSquared.get() != null) {
|
||||
File file = new File(PlotSquared.imp().getDirectory(),
|
||||
Settings.Paths.SCRIPTS + File.separator + "start.js");
|
||||
if (file.exists()) {
|
||||
init();
|
||||
String script = StringMan.join(Files.readLines(new File(new File(
|
||||
PlotSquared.imp().getDirectory() + File.separator
|
||||
+ Settings.Paths.SCRIPTS), "start.js"), StandardCharsets.UTF_8),
|
||||
System.getProperty("line.separator"));
|
||||
this.scope.put("THIS", this);
|
||||
this.scope.put("PlotPlayer", ConsolePlayer.getConsole());
|
||||
this.engine.eval(script, this.scope);
|
||||
}
|
||||
}
|
||||
} catch (IOException | ScriptException ignored) {
|
||||
ignored.printStackTrace();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public ScriptEngine getEngine() {
|
||||
@ -167,21 +172,21 @@ public class DebugExec extends SubCommand {
|
||||
|
||||
// Instances
|
||||
this.scope.put("PS", PlotSquared.get());
|
||||
this.scope.put("GlobalBlockQueue", GlobalBlockQueue.IMP);
|
||||
this.scope.put("GlobalBlockQueue", this.blockQueue);
|
||||
this.scope.put("ExpireManager", ExpireManager.IMP);
|
||||
if (this.worldEdit != null) {
|
||||
this.scope.put("WEManager", new WEManager());
|
||||
}
|
||||
this.scope.put("TaskManager", TaskManager.IMP);
|
||||
this.scope.put("TaskManager", TaskManager.getImplementation());
|
||||
this.scope.put("ConsolePlayer", ConsolePlayer.getConsole());
|
||||
this.scope.put("SchematicHandler", SchematicHandler.manager);
|
||||
this.scope.put("ChunkManager", ChunkManager.manager);
|
||||
this.scope.put("BlockManager", WorldUtil.IMP);
|
||||
this.scope.put("SetupUtils", SetupUtils.manager);
|
||||
this.scope.put("SchematicHandler", this.schematicHandler);
|
||||
this.scope.put("ChunkManager", this.chunkManager);
|
||||
this.scope.put("BlockManager", this.worldUtil);
|
||||
this.scope.put("SetupUtils", this.setupUtils);
|
||||
this.scope.put("EventUtil", this.eventDispatcher);
|
||||
this.scope.put("EconHandler", EconHandler.getEconHandler());
|
||||
this.scope.put("EconHandler", this.econHandler);
|
||||
this.scope.put("DBFunc", DBFunc.dbManager);
|
||||
this.scope.put("HybridUtils", HybridUtils.manager);
|
||||
this.scope.put("HybridUtils", this.hybridUtils);
|
||||
this.scope.put("IMP", PlotSquared.platform());
|
||||
this.scope.put("MainCommand", MainCommand.getInstance());
|
||||
|
||||
@ -213,7 +218,7 @@ public class DebugExec extends SubCommand {
|
||||
return true;
|
||||
}
|
||||
MainUtil.sendMessage(player, "$1Starting task...");
|
||||
HybridUtils.manager.analyzePlot(plot, new RunnableVal<PlotAnalysis>() {
|
||||
this.hybridUtils.analyzePlot(plot, new RunnableVal<PlotAnalysis>() {
|
||||
@Override public void run(PlotAnalysis value) {
|
||||
MainUtil.sendMessage(player,
|
||||
"$1Done: $2Use $3/plot debugexec analyze$2 for more information");
|
||||
@ -279,10 +284,9 @@ public class DebugExec extends SubCommand {
|
||||
}
|
||||
boolean result;
|
||||
if (HybridUtils.regions != null) {
|
||||
result = HybridUtils.manager
|
||||
.scheduleRoadUpdate(area, HybridUtils.regions, 0, new HashSet<>());
|
||||
result = this.hybridUtils.scheduleRoadUpdate(area, HybridUtils.regions, 0, new HashSet<>());
|
||||
} else {
|
||||
result = HybridUtils.manager.scheduleRoadUpdate(area, 0);
|
||||
result = this.hybridUtils.scheduleRoadUpdate(area, 0);
|
||||
}
|
||||
if (!result) {
|
||||
MainUtil.sendMessage(player,
|
||||
|
@ -26,6 +26,7 @@
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.inject.Inject;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
@ -36,7 +37,7 @@ import com.plotsquared.core.plot.world.SinglePlotAreaManager;
|
||||
import com.plotsquared.core.util.WorldUtil;
|
||||
import com.plotsquared.core.util.task.RunnableVal2;
|
||||
import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
@ -50,10 +51,13 @@ import java.util.concurrent.CompletableFuture;
|
||||
public class DebugImportWorlds extends Command {
|
||||
|
||||
private final PlotAreaManager plotAreaManager;
|
||||
private final WorldUtil worldUtil;
|
||||
|
||||
public DebugImportWorlds(@NotNull final PlotAreaManager plotAreaManager) {
|
||||
@Inject public DebugImportWorlds(@Nonnull final PlotAreaManager plotAreaManager,
|
||||
@Nonnull final WorldUtil worldUtil) {
|
||||
super(MainCommand.getInstance(), true);
|
||||
this.plotAreaManager = plotAreaManager;
|
||||
this.worldUtil = worldUtil;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -75,7 +79,7 @@ public class DebugImportWorlds extends Command {
|
||||
}
|
||||
for (File folder : container.listFiles()) {
|
||||
String name = folder.getName();
|
||||
if (!WorldUtil.IMP.isWorld(name) && PlotId.fromStringOrNull(name) == null) {
|
||||
if (!this.worldUtil.isWorld(name) && PlotId.fromStringOrNull(name) == null) {
|
||||
UUID uuid;
|
||||
if (name.length() > 16) {
|
||||
uuid = UUID.fromString(name);
|
||||
|
@ -27,6 +27,7 @@ package com.plotsquared.core.command;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.inject.Inject;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.inject.annotations.ConfigFile;
|
||||
import com.plotsquared.core.inject.annotations.WorldFile;
|
||||
@ -37,8 +38,8 @@ import com.plotsquared.core.util.MainUtil;
|
||||
import com.plotsquared.core.util.PremiumVerification;
|
||||
import com.plotsquared.core.util.net.IncendoPaster;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import lombok.NonNull;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
@ -65,13 +66,13 @@ public class DebugPaste extends SubCommand {
|
||||
private final File configFile;
|
||||
private final File worldfile;
|
||||
|
||||
public DebugPaste(@ConfigFile @NotNull final File configFile,
|
||||
@WorldFile @NotNull final File worldFile) {
|
||||
@Inject public DebugPaste(@ConfigFile @Nonnull final File configFile,
|
||||
@WorldFile @Nonnull final File worldFile) {
|
||||
this.configFile = configFile;
|
||||
this.worldfile = worldFile;
|
||||
}
|
||||
|
||||
private static String readFile(@NonNull final File file) throws IOException {
|
||||
private static String readFile(@Nonnull final File file) throws IOException {
|
||||
final List<String> lines;
|
||||
try (final BufferedReader reader = new BufferedReader(new FileReader(file))) {
|
||||
lines = reader.lines().collect(Collectors.toList());
|
||||
|
@ -35,7 +35,7 @@ import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.plot.PlotManager;
|
||||
import com.plotsquared.core.util.MainUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@ -51,7 +51,7 @@ public class DebugRoadRegen extends SubCommand {
|
||||
|
||||
private final HybridUtils hybridUtils;
|
||||
|
||||
@Inject public DebugRoadRegen(@NotNull final HybridUtils hybridUtils) {
|
||||
@Inject public DebugRoadRegen(@Nonnull final HybridUtils hybridUtils) {
|
||||
this.hybridUtils = hybridUtils;
|
||||
}
|
||||
|
||||
|
@ -39,8 +39,8 @@ import com.plotsquared.core.util.Expression;
|
||||
import com.plotsquared.core.util.MainUtil;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
||||
@CommandDeclaration(command = "delete",
|
||||
@ -56,7 +56,7 @@ public class Delete extends SubCommand {
|
||||
private final EventDispatcher eventDispatcher;
|
||||
private final EconHandler econHandler;
|
||||
|
||||
@Inject public Delete(@NotNull final EventDispatcher eventDispatcher,
|
||||
@Inject public Delete(@Nonnull final EventDispatcher eventDispatcher,
|
||||
@Nullable final EconHandler econHandler) {
|
||||
this.eventDispatcher = eventDispatcher;
|
||||
this.econHandler = econHandler;
|
||||
|
@ -39,7 +39,7 @@ import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.TabCompletions;
|
||||
import com.plotsquared.core.util.WorldUtil;
|
||||
import com.sk89q.worldedit.world.gamemode.GameModes;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@ -58,9 +58,9 @@ public class Deny extends SubCommand {
|
||||
private final EventDispatcher eventDispatcher;
|
||||
private final WorldUtil worldUtil;
|
||||
|
||||
@Inject public Deny(@NotNull final PlotAreaManager plotAreaManager,
|
||||
@NotNull final EventDispatcher eventDispatcher,
|
||||
@NotNull final WorldUtil worldUtil) {
|
||||
@Inject public Deny(@Nonnull final PlotAreaManager plotAreaManager,
|
||||
@Nonnull final EventDispatcher eventDispatcher,
|
||||
@Nonnull final WorldUtil worldUtil) {
|
||||
super(Argument.PlayerName);
|
||||
this.plotAreaManager = plotAreaManager;
|
||||
this.eventDispatcher = eventDispatcher;
|
||||
|
@ -25,6 +25,7 @@
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.events.PlotFlagAddEvent;
|
||||
import com.plotsquared.core.events.PlotFlagRemoveEvent;
|
||||
@ -34,7 +35,7 @@ import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.flag.implementations.DescriptionFlag;
|
||||
import com.plotsquared.core.util.EventDispatcher;
|
||||
import com.plotsquared.core.util.MainUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@CommandDeclaration(command = "setdescription",
|
||||
permission = "plots.set.desc",
|
||||
@ -47,7 +48,7 @@ public class Desc extends SetCommand {
|
||||
|
||||
private final EventDispatcher eventDispatcher;
|
||||
|
||||
public Desc(@NotNull final EventDispatcher eventDispatcher) {
|
||||
@Inject public Desc(@Nonnull final EventDispatcher eventDispatcher) {
|
||||
this.eventDispatcher = eventDispatcher;
|
||||
}
|
||||
|
||||
|
@ -25,8 +25,9 @@
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@CommandDeclaration(command = "dislike",
|
||||
permission = "plots.dislike",
|
||||
@ -38,7 +39,7 @@ public class Dislike extends SubCommand {
|
||||
|
||||
private final Like like;
|
||||
|
||||
public Dislike(@NotNull final Like like) {
|
||||
@Inject public Dislike(@Nonnull final Like like) {
|
||||
this.like = like;
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
import com.plotsquared.core.events.PlotDoneEvent;
|
||||
@ -42,7 +43,7 @@ import com.plotsquared.core.util.EventDispatcher;
|
||||
import com.plotsquared.core.util.MainUtil;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@CommandDeclaration(command = "done",
|
||||
aliases = {"submit"},
|
||||
@ -53,9 +54,12 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class Done extends SubCommand {
|
||||
|
||||
private final EventDispatcher eventDispatcher;
|
||||
|
||||
public Done(@NotNull final EventDispatcher eventDispatcher) {
|
||||
private final HybridUtils hybridUtils;
|
||||
|
||||
@Inject public Done(@Nonnull final EventDispatcher eventDispatcher,
|
||||
@Nonnull final HybridUtils hybridUtils) {
|
||||
this.eventDispatcher = eventDispatcher;
|
||||
this.hybridUtils = hybridUtils;
|
||||
}
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
||||
@ -90,7 +94,7 @@ public class Done extends SubCommand {
|
||||
finish(plot, player, true);
|
||||
plot.removeRunning();
|
||||
} else {
|
||||
HybridUtils.manager.analyzePlot(plot, new RunnableVal<PlotAnalysis>() {
|
||||
this.hybridUtils.analyzePlot(plot, new RunnableVal<PlotAnalysis>() {
|
||||
@Override public void run(PlotAnalysis value) {
|
||||
plot.removeRunning();
|
||||
boolean result =
|
||||
|
@ -25,6 +25,7 @@
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
@ -38,7 +39,7 @@ import com.plotsquared.core.util.StringMan;
|
||||
import com.plotsquared.core.util.WorldUtil;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
@ -52,9 +53,15 @@ import java.net.URL;
|
||||
public class Download extends SubCommand {
|
||||
|
||||
private final PlotAreaManager plotAreaManager;
|
||||
private final SchematicHandler schematicHandler;
|
||||
private final WorldUtil worldUtil;
|
||||
|
||||
public Download(@NotNull final PlotAreaManager plotAreaManager) {
|
||||
@Inject public Download(@Nonnull final PlotAreaManager plotAreaManager,
|
||||
@Nonnull final SchematicHandler schematicHandler,
|
||||
@Nonnull final WorldUtil worldUtil) {
|
||||
this.plotAreaManager = plotAreaManager;
|
||||
this.schematicHandler = schematicHandler;
|
||||
this.worldUtil = worldUtil;
|
||||
}
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
||||
@ -91,10 +98,10 @@ public class Download extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
plot.addRunning();
|
||||
SchematicHandler.manager.getCompoundTag(plot, new RunnableVal<CompoundTag>() {
|
||||
this.schematicHandler.getCompoundTag(plot, new RunnableVal<CompoundTag>() {
|
||||
@Override public void run(CompoundTag value) {
|
||||
plot.removeRunning();
|
||||
SchematicHandler.manager.upload(value, null, null, new RunnableVal<URL>() {
|
||||
schematicHandler.upload(value, null, null, new RunnableVal<URL>() {
|
||||
@Override public void run(URL url) {
|
||||
if (url == null) {
|
||||
MainUtil.sendMessage(player, Captions.GENERATING_LINK_FAILED);
|
||||
@ -113,8 +120,8 @@ public class Download extends SubCommand {
|
||||
}
|
||||
MainUtil.sendMessage(player, Captions.MCA_FILE_SIZE);
|
||||
plot.addRunning();
|
||||
WorldUtil.IMP.saveWorld(world);
|
||||
WorldUtil.IMP.upload(plot, null, null, new RunnableVal<URL>() {
|
||||
this.worldUtil.saveWorld(world);
|
||||
this.worldUtil.upload(plot, null, null, new RunnableVal<URL>() {
|
||||
@Override public void run(URL url) {
|
||||
plot.removeRunning();
|
||||
if (url == null) {
|
||||
|
@ -50,8 +50,8 @@ import com.plotsquared.core.util.StringMan;
|
||||
import com.plotsquared.core.util.helpmenu.HelpMenu;
|
||||
import com.plotsquared.core.util.task.RunnableVal2;
|
||||
import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
@ -87,7 +87,7 @@ public final class FlagCommand extends Command {
|
||||
}
|
||||
|
||||
private static boolean checkPermValue(@Nonnull final PlotPlayer player,
|
||||
@NotNull final PlotFlag<?, ?> flag, @NotNull String key, @NotNull String value) {
|
||||
@Nonnull final PlotFlag<?, ?> flag, @Nonnull String key, @Nonnull String value) {
|
||||
key = key.toLowerCase();
|
||||
value = value.toLowerCase();
|
||||
String perm = CaptionUtility
|
||||
@ -152,7 +152,7 @@ public final class FlagCommand extends Command {
|
||||
*
|
||||
* @return true if the player is allowed to modify the flags at their current location
|
||||
*/
|
||||
private static boolean checkRequirements(@NotNull final PlotPlayer player) {
|
||||
private static boolean checkRequirements(@Nonnull final PlotPlayer player) {
|
||||
final Location location = player.getLocation();
|
||||
final Plot plot = location.getPlotAbs();
|
||||
if (plot == null) {
|
||||
@ -180,8 +180,8 @@ public final class FlagCommand extends Command {
|
||||
* @param arg String to extract flag from
|
||||
* @return The flag, if found, else null
|
||||
*/
|
||||
@Nullable private static PlotFlag<?, ?> getFlag(@NotNull final PlotPlayer player,
|
||||
@NotNull final String arg) {
|
||||
@Nullable private static PlotFlag<?, ?> getFlag(@Nonnull final PlotPlayer player,
|
||||
@Nonnull final String arg) {
|
||||
if (arg != null && arg.length() > 0) {
|
||||
final PlotFlag<?, ?> flag = GlobalFlagContainer.getInstance().getFlagFromString(arg);
|
||||
if (flag instanceof InternalFlag || flag == null) {
|
||||
|
@ -25,6 +25,7 @@
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.events.TeleportCause;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
@ -40,7 +41,7 @@ import com.plotsquared.core.util.query.PlotQuery;
|
||||
import com.plotsquared.core.util.query.SortingStrategy;
|
||||
import com.plotsquared.core.util.task.RunnableVal2;
|
||||
import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@ -58,13 +59,13 @@ public class HomeCommand extends Command {
|
||||
|
||||
private final PlotAreaManager plotAreaManager;
|
||||
|
||||
public HomeCommand(@NotNull final PlotAreaManager plotAreaManager) {
|
||||
@Inject public HomeCommand(@Nonnull final PlotAreaManager plotAreaManager) {
|
||||
super(MainCommand.getInstance(), true);
|
||||
this.plotAreaManager = plotAreaManager;
|
||||
}
|
||||
|
||||
private void home(@NotNull final PlotPlayer<?> player,
|
||||
@NotNull final PlotQuery query, final int page,
|
||||
private void home(@Nonnull final PlotPlayer<?> player,
|
||||
@Nonnull final PlotQuery query, final int page,
|
||||
final RunnableVal3<Command, Runnable, Runnable> confirm,
|
||||
final RunnableVal2<Command, CommandResult> whenDone) {
|
||||
List<Plot> plots = query.asList();
|
||||
@ -86,7 +87,7 @@ public class HomeCommand extends Command {
|
||||
}), () -> whenDone.run(HomeCommand.this, CommandResult.FAILURE));
|
||||
}
|
||||
|
||||
@NotNull private PlotQuery query(@NotNull final PlotPlayer<?> player) {
|
||||
@Nonnull private PlotQuery query(@Nonnull final PlotPlayer<?> player) {
|
||||
// everything plots need to have in common here
|
||||
return PlotQuery.newQuery().ownedBy(player);
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ import com.plotsquared.core.util.MainUtil;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.TabCompletions;
|
||||
import com.plotsquared.core.util.WorldUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@ -58,8 +58,8 @@ public class Kick extends SubCommand {
|
||||
private final PlotAreaManager plotAreaManager;
|
||||
private final WorldUtil worldUtil;
|
||||
|
||||
@Inject public Kick(@NotNull final PlotAreaManager plotAreaManager,
|
||||
@NotNull final WorldUtil worldUtil) {
|
||||
@Inject public Kick(@Nonnull final PlotAreaManager plotAreaManager,
|
||||
@Nonnull final WorldUtil worldUtil) {
|
||||
super(Argument.PlayerName);
|
||||
this.plotAreaManager = plotAreaManager;
|
||||
this.worldUtil = worldUtil;
|
||||
|
@ -25,6 +25,7 @@
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
@ -32,7 +33,7 @@ import com.plotsquared.core.util.EventDispatcher;
|
||||
import com.plotsquared.core.util.MainUtil;
|
||||
import com.plotsquared.core.util.task.RunnableVal2;
|
||||
import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@ -47,7 +48,7 @@ public class Leave extends Command {
|
||||
|
||||
private final EventDispatcher eventDispatcher;
|
||||
|
||||
public Leave(@NotNull final EventDispatcher eventDispatcher) {
|
||||
@Inject public Leave(@Nonnull final EventDispatcher eventDispatcher) {
|
||||
super(MainCommand.getInstance(), true);
|
||||
this.eventDispatcher = eventDispatcher;
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
@ -39,7 +40,7 @@ import com.plotsquared.core.util.EventDispatcher;
|
||||
import com.plotsquared.core.util.MainUtil;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@ -57,7 +58,7 @@ public class Like extends SubCommand {
|
||||
|
||||
private final EventDispatcher eventDispatcher;
|
||||
|
||||
public Like(@NotNull final EventDispatcher eventDispatcher) {
|
||||
@Inject public Like(@Nonnull final EventDispatcher eventDispatcher) {
|
||||
this.eventDispatcher = eventDispatcher;
|
||||
}
|
||||
|
||||
|
@ -49,8 +49,8 @@ import com.plotsquared.core.util.query.PlotQuery;
|
||||
import com.plotsquared.core.util.query.SortingStrategy;
|
||||
import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import com.plotsquared.core.uuid.UUIDMapping;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -76,7 +76,7 @@ public class ListCmd extends SubCommand {
|
||||
private final PlotAreaManager plotAreaManager;
|
||||
private final EconHandler econHandler;
|
||||
|
||||
@Inject public ListCmd(@NotNull final PlotAreaManager plotAreaManager,
|
||||
@Inject public ListCmd(@Nonnull final PlotAreaManager plotAreaManager,
|
||||
@Nullable final EconHandler econHandler) {
|
||||
this.plotAreaManager = plotAreaManager;
|
||||
this.econHandler = econHandler;
|
||||
|
@ -39,7 +39,7 @@ import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.SchematicHandler;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
@ -57,8 +57,8 @@ public class Load extends SubCommand {
|
||||
private final PlotAreaManager plotAreaManager;
|
||||
private final SchematicHandler schematicHandler;
|
||||
|
||||
@Inject public Load(@NotNull final PlotAreaManager plotAreaManager,
|
||||
@NotNull final SchematicHandler schematicHandler) {
|
||||
@Inject public Load(@Nonnull final PlotAreaManager plotAreaManager,
|
||||
@Nonnull final SchematicHandler schematicHandler) {
|
||||
this.plotAreaManager = plotAreaManager;
|
||||
this.schematicHandler = schematicHandler;
|
||||
}
|
||||
|
@ -29,23 +29,17 @@ import com.google.inject.Injector;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
import com.plotsquared.core.configuration.file.YamlConfiguration;
|
||||
import com.plotsquared.core.listener.PlotListener;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.player.ConsolePlayer;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||
import com.plotsquared.core.util.EconHandler;
|
||||
import com.plotsquared.core.util.EventDispatcher;
|
||||
import com.plotsquared.core.util.Expression;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.task.RunnableVal2;
|
||||
import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@ -152,12 +146,13 @@ public class MainCommand extends Command {
|
||||
|
||||
// Referenced commands
|
||||
instance.toggle = injector.getInstance(Toggle.class);
|
||||
instance.help = injector.getInstance(Help.class);
|
||||
instance.help = new Help(instance);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public static boolean onCommand(final PlotPlayer<?> player, String... args) {
|
||||
final EconHandler econHandler = PlotSquared.platform().getEconHandler();
|
||||
if (args.length >= 1 && args[0].contains(":")) {
|
||||
String[] split2 = args[0].split(":");
|
||||
if (split2.length == 2) {
|
||||
@ -179,14 +174,14 @@ public class MainCommand extends Command {
|
||||
public void run(final Command cmd, final Runnable success, final Runnable failure) {
|
||||
if (cmd.hasConfirmation(player)) {
|
||||
CmdConfirm.addPending(player, cmd.getUsage(), () -> {
|
||||
if (EconHandler.getEconHandler() != null) {
|
||||
if (econHandler != null) {
|
||||
PlotArea area = player.getApplicablePlotArea();
|
||||
if (area != null) {
|
||||
Expression<Double> priceEval =
|
||||
area.getPrices().get(cmd.getFullId());
|
||||
Double price = priceEval != null ? priceEval.evaluate(0d) : 0d;
|
||||
if (price != null
|
||||
&& EconHandler.getEconHandler().getMoney(player) < price) {
|
||||
&& econHandler.getMoney(player) < price) {
|
||||
if (failure != null) {
|
||||
failure.run();
|
||||
}
|
||||
@ -200,12 +195,12 @@ public class MainCommand extends Command {
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (EconHandler.getEconHandler() != null) {
|
||||
if (econHandler != null) {
|
||||
PlotArea area = player.getApplicablePlotArea();
|
||||
if (area != null) {
|
||||
Expression<Double> priceEval = area.getPrices().get(cmd.getFullId());
|
||||
Double price = priceEval != null ? priceEval.evaluate(0d) : 0d;
|
||||
if (price != 0d && EconHandler.getEconHandler().getMoney(player) < price) {
|
||||
if (price != 0d && econHandler.getMoney(player) < price) {
|
||||
if (failure != null) {
|
||||
failure.run();
|
||||
}
|
||||
@ -267,14 +262,14 @@ public class MainCommand extends Command {
|
||||
if ("f".equals(args[0].substring(1))) {
|
||||
confirm = new RunnableVal3<Command, Runnable, Runnable>() {
|
||||
@Override public void run(Command cmd, Runnable success, Runnable failure) {
|
||||
if (EconHandler.getEconHandler() != null) {
|
||||
if (PlotSquared.platform().getEconHandler() != null) {
|
||||
PlotArea area = player.getApplicablePlotArea();
|
||||
if (area != null) {
|
||||
Expression<Double> priceEval =
|
||||
area.getPrices().get(cmd.getFullId());
|
||||
Double price = priceEval != null ? priceEval.evaluate(0d) : 0d;
|
||||
if (price != 0d
|
||||
&& EconHandler.getEconHandler().getMoney(player) < price) {
|
||||
&& PlotSquared.platform().getEconHandler().getMoney(player) < price) {
|
||||
if (failure != null) {
|
||||
failure.run();
|
||||
}
|
||||
|
@ -42,8 +42,8 @@ import com.plotsquared.core.util.Expression;
|
||||
import com.plotsquared.core.util.MainUtil;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.StringMan;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@ -63,7 +63,7 @@ public class Merge extends SubCommand {
|
||||
private final EventDispatcher eventDispatcher;
|
||||
private final EconHandler econHandler;
|
||||
|
||||
@Inject public Merge(@NotNull final EventDispatcher eventDispatcher,
|
||||
@Inject public Merge(@Nonnull final EventDispatcher eventDispatcher,
|
||||
@Nullable final EconHandler econHandler) {
|
||||
this.eventDispatcher = eventDispatcher;
|
||||
this.econHandler = econHandler;
|
||||
|
@ -25,6 +25,7 @@
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
@ -35,7 +36,7 @@ import com.plotsquared.core.util.MainUtil;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.task.RunnableVal2;
|
||||
import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@ -49,7 +50,7 @@ public class Move extends SubCommand {
|
||||
|
||||
private final PlotAreaManager plotAreaManager;
|
||||
|
||||
public Move(@NotNull final PlotAreaManager plotAreaManager) {
|
||||
@Inject public Move(@Nonnull final PlotAreaManager plotAreaManager) {
|
||||
this.plotAreaManager = plotAreaManager;
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ import com.plotsquared.core.plot.flag.PlotFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.MusicFlag;
|
||||
import com.plotsquared.core.util.InventoryUtil;
|
||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
@ -25,6 +25,7 @@
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
@ -37,7 +38,7 @@ import com.plotsquared.core.util.EventDispatcher;
|
||||
import com.plotsquared.core.util.MainUtil;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
@ -56,7 +57,7 @@ public class Owner extends SetCommand {
|
||||
|
||||
private final EventDispatcher eventDispatcher;
|
||||
|
||||
public Owner(@NotNull final EventDispatcher eventDispatcher) {
|
||||
@Inject public Owner(@Nonnull final EventDispatcher eventDispatcher) {
|
||||
this.eventDispatcher = eventDispatcher;
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ import com.plotsquared.core.util.task.TaskManager;
|
||||
public class PluginCmd extends SubCommand {
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
||||
TaskManager.IMP.taskAsync(() -> {
|
||||
TaskManager.getImplementation().taskAsync(() -> {
|
||||
MainUtil.sendMessage(player, String.format(
|
||||
"$2>> $1&l" + PlotSquared.platform().getPluginName() + " $2($1Version$2: $1%s$2)",
|
||||
PlotSquared.get().getVersion()));
|
||||
|
@ -25,6 +25,7 @@
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
@ -37,7 +38,7 @@ import com.plotsquared.core.plot.PlotId;
|
||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||
import com.plotsquared.core.util.StringMan;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@ -58,7 +59,8 @@ public class Purge extends SubCommand {
|
||||
private final PlotAreaManager plotAreaManager;
|
||||
private final PlotListener plotListener;
|
||||
|
||||
public Purge(@NotNull final PlotAreaManager plotAreaManager, @NotNull final PlotListener plotListener) {
|
||||
@Inject public Purge(@Nonnull final PlotAreaManager plotAreaManager,
|
||||
@Nonnull final PlotListener plotListener) {
|
||||
this.plotAreaManager = plotAreaManager;
|
||||
this.plotListener = plotListener;
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
@ -38,11 +39,12 @@ import com.plotsquared.core.plot.PlotItemStack;
|
||||
import com.plotsquared.core.plot.Rating;
|
||||
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
||||
import com.plotsquared.core.util.EventDispatcher;
|
||||
import com.plotsquared.core.util.InventoryUtil;
|
||||
import com.plotsquared.core.util.MainUtil;
|
||||
import com.plotsquared.core.util.MathMan;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@ -59,9 +61,12 @@ import java.util.UUID;
|
||||
public class Rate extends SubCommand {
|
||||
|
||||
private final EventDispatcher eventDispatcher;
|
||||
private final InventoryUtil inventoryUtil;
|
||||
|
||||
public Rate(@NotNull final EventDispatcher eventDispatcher) {
|
||||
@Inject public Rate(@Nonnull final EventDispatcher eventDispatcher,
|
||||
@Nonnull final InventoryUtil inventoryUtil) {
|
||||
this.eventDispatcher = eventDispatcher;
|
||||
this.inventoryUtil = inventoryUtil;
|
||||
}
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
||||
@ -143,7 +148,7 @@ public class Rate extends SubCommand {
|
||||
final MutableInt index = new MutableInt(0);
|
||||
final MutableInt rating = new MutableInt(0);
|
||||
String title = Settings.Ratings.CATEGORIES.get(0);
|
||||
PlotInventory inventory = new PlotInventory(player, 1, title) {
|
||||
PlotInventory inventory = new PlotInventory(inventoryUtil, player, 1, title) {
|
||||
@Override public boolean onClick(int i) {
|
||||
rating.add((i + 1) * Math.pow(10, index.getValue()));
|
||||
index.increment();
|
||||
|
@ -34,7 +34,7 @@ import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.plot.PlotManager;
|
||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||
import com.plotsquared.core.util.MainUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@CommandDeclaration(command = "regenallroads",
|
||||
description = "Regenerate all roads in the map using the set road schematic",
|
||||
@ -48,8 +48,8 @@ public class RegenAllRoads extends SubCommand {
|
||||
private final PlotAreaManager plotAreaManager;
|
||||
private final HybridUtils hybridUtils;
|
||||
|
||||
@Inject public RegenAllRoads(@NotNull final PlotAreaManager plotAreaManager,
|
||||
@NotNull final HybridUtils hybridUtils) {
|
||||
@Inject public RegenAllRoads(@Nonnull final PlotAreaManager plotAreaManager,
|
||||
@Nonnull final HybridUtils hybridUtils) {
|
||||
this.plotAreaManager = plotAreaManager;
|
||||
this.hybridUtils = hybridUtils;
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.inject.annotations.WorldConfig;
|
||||
import com.plotsquared.core.inject.annotations.WorldFile;
|
||||
@ -36,7 +37,7 @@ import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.PlotAreaType;
|
||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||
import com.plotsquared.core.util.MainUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -54,9 +55,9 @@ public class Reload extends SubCommand {
|
||||
private final YamlConfiguration worldConfiguration;
|
||||
private final File worldFile;
|
||||
|
||||
public Reload(@NotNull final PlotAreaManager plotAreaManager,
|
||||
@WorldConfig @NotNull final YamlConfiguration worldConfiguration,
|
||||
@WorldFile @NotNull final File worldFile) {
|
||||
@Inject public Reload(@Nonnull final PlotAreaManager plotAreaManager,
|
||||
@WorldConfig @Nonnull final YamlConfiguration worldConfiguration,
|
||||
@WorldFile @Nonnull final File worldFile) {
|
||||
this.plotAreaManager = plotAreaManager;
|
||||
this.worldConfiguration = worldConfiguration;
|
||||
this.worldFile = worldFile;
|
||||
|
@ -25,6 +25,7 @@
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.database.DBFunc;
|
||||
import com.plotsquared.core.location.Location;
|
||||
@ -34,7 +35,7 @@ import com.plotsquared.core.util.EventDispatcher;
|
||||
import com.plotsquared.core.util.MainUtil;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.TabCompletions;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@ -52,7 +53,7 @@ public class Remove extends SubCommand {
|
||||
|
||||
private final EventDispatcher eventDispatcher;
|
||||
|
||||
public Remove(@NotNull final EventDispatcher eventDispatcher) {
|
||||
@Inject public Remove(@Nonnull final EventDispatcher eventDispatcher) {
|
||||
super(Argument.PlayerName);
|
||||
this.eventDispatcher = eventDispatcher;
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.location.Location;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
@ -37,7 +38,7 @@ import com.plotsquared.core.util.SchematicHandler;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
@ -51,9 +52,12 @@ import java.util.UUID;
|
||||
public class Save extends SubCommand {
|
||||
|
||||
private final PlotAreaManager plotAreaManager;
|
||||
private final SchematicHandler schematicHandler;
|
||||
|
||||
public Save(@NotNull final PlotAreaManager plotAreaManager) {
|
||||
@Inject public Save(@Nonnull final PlotAreaManager plotAreaManager,
|
||||
@Nonnull final SchematicHandler schematicHandler) {
|
||||
this.plotAreaManager = plotAreaManager;
|
||||
this.schematicHandler = schematicHandler;
|
||||
}
|
||||
|
||||
@Override public boolean onCommand(final PlotPlayer<?> player, final String[] args) {
|
||||
@ -79,7 +83,7 @@ public class Save extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
plot.addRunning();
|
||||
SchematicHandler.manager.getCompoundTag(plot, new RunnableVal<CompoundTag>() {
|
||||
this.schematicHandler.getCompoundTag(plot, new RunnableVal<CompoundTag>() {
|
||||
@Override public void run(final CompoundTag value) {
|
||||
TaskManager.runTaskAsync(() -> {
|
||||
String time = (System.currentTimeMillis() / 1000) + "";
|
||||
@ -92,7 +96,7 @@ public class Save extends SubCommand {
|
||||
.replaceAll("[^A-Za-z0-9]", "");
|
||||
final String file = time + '_' + world1 + '_' + id.x + '_' + id.y + '_' + size;
|
||||
UUID uuid = player.getUUID();
|
||||
SchematicHandler.manager.upload(value, uuid, file, new RunnableVal<URL>() {
|
||||
schematicHandler.upload(value, uuid, file, new RunnableVal<URL>() {
|
||||
@Override public void run(URL url) {
|
||||
plot.removeRunning();
|
||||
if (url == null) {
|
||||
|
@ -42,7 +42,7 @@ import com.plotsquared.core.util.SchematicHandler;
|
||||
import com.plotsquared.core.util.StringMan;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
@ -61,8 +61,8 @@ public class SchematicCmd extends SubCommand {
|
||||
private final SchematicHandler schematicHandler;
|
||||
private boolean running = false;
|
||||
|
||||
@Inject public SchematicCmd(@NotNull final PlotAreaManager plotAreaManager,
|
||||
@NotNull final SchematicHandler schematicHandler) {
|
||||
@Inject public SchematicCmd(@Nonnull final PlotAreaManager plotAreaManager,
|
||||
@Nonnull final SchematicHandler schematicHandler) {
|
||||
this.plotAreaManager = plotAreaManager;
|
||||
this.schematicHandler = schematicHandler;
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.plotsquared.core.backup.BackupManager;
|
||||
import com.plotsquared.core.configuration.CaptionUtility;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
@ -44,6 +45,7 @@ import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.world.block.BlockCategory;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -67,8 +69,13 @@ public class Set extends SubCommand {
|
||||
public static final String[] aliases = new String[] {"b", "w", "wf", "a", "h"};
|
||||
|
||||
private final SetCommand component;
|
||||
private final WorldUtil worldUtil;
|
||||
private final GlobalBlockQueue blockQueue;
|
||||
|
||||
public Set() {
|
||||
@Inject public Set(@Nonnull final WorldUtil worldUtil,
|
||||
@Nonnull final GlobalBlockQueue blockQueue) {
|
||||
this.worldUtil = worldUtil;
|
||||
this.blockQueue = blockQueue;
|
||||
this.component = new SetCommand() {
|
||||
|
||||
@Override public String getId() {
|
||||
@ -91,7 +98,7 @@ public class Set extends SubCommand {
|
||||
final List<String> forbiddenTypes = new ArrayList<>(Settings.General.INVALID_BLOCKS);
|
||||
|
||||
if (Settings.Enabled_Components.CHUNK_PROCESSOR) {
|
||||
forbiddenTypes.addAll(WorldUtil.IMP.getTileEntityTypes().stream().map(
|
||||
forbiddenTypes.addAll(worldUtil.getTileEntityTypes().stream().map(
|
||||
BlockType::getName).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
@ -154,7 +161,7 @@ public class Set extends SubCommand {
|
||||
current.setComponent(component, pattern);
|
||||
}
|
||||
MainUtil.sendMessage(player, Captions.GENERATING_COMPONENT);
|
||||
GlobalBlockQueue.IMP.addEmptyTask(plot::removeRunning);
|
||||
blockQueue.addEmptyTask(plot::removeRunning);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.generator.GeneratorWrapper;
|
||||
@ -33,6 +34,7 @@ import com.plotsquared.core.setup.SetupProcess;
|
||||
import com.plotsquared.core.setup.SetupStep;
|
||||
import com.plotsquared.core.util.MainUtil;
|
||||
import com.plotsquared.core.util.SetupUtils;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@ -48,6 +50,12 @@ import java.util.Map.Entry;
|
||||
category = CommandCategory.ADMINISTRATION)
|
||||
public class Setup extends SubCommand {
|
||||
|
||||
private final SetupUtils setupUtils;
|
||||
|
||||
@Inject public Setup(@Nonnull final SetupUtils setupUtils) {
|
||||
this.setupUtils = setupUtils;
|
||||
}
|
||||
|
||||
public void displayGenerators(PlotPlayer<?> player) {
|
||||
StringBuilder message = new StringBuilder();
|
||||
message.append("&6What generator do you want?");
|
||||
@ -72,7 +80,7 @@ public class Setup extends SubCommand {
|
||||
}
|
||||
process = new SetupProcess();
|
||||
player.setMeta("setup", process);
|
||||
SetupUtils.manager.updateGenerators();
|
||||
this.setupUtils.updateGenerators();
|
||||
SetupStep step = process.getCurrentStep();
|
||||
step.announce(player);
|
||||
displayGenerators(player);
|
||||
|
@ -48,7 +48,7 @@ import com.plotsquared.core.util.MainUtil;
|
||||
import com.plotsquared.core.util.SetupUtils;
|
||||
import com.plotsquared.core.util.WorldUtil;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@ -73,12 +73,12 @@ public class Template extends SubCommand {
|
||||
private final GlobalBlockQueue globalBlockQueue;
|
||||
private final WorldUtil worldUtil;
|
||||
|
||||
@Inject public Template(@NotNull final PlotAreaManager plotAreaManager,
|
||||
@WorldConfig @NotNull final YamlConfiguration worldConfiguration,
|
||||
@WorldFile @NotNull final File worldFile,
|
||||
@NotNull final SetupUtils setupUtils,
|
||||
@NotNull final GlobalBlockQueue globalBlockQueue,
|
||||
@NotNull final WorldUtil worldUtil) {
|
||||
@Inject public Template(@Nonnull final PlotAreaManager plotAreaManager,
|
||||
@WorldConfig @Nonnull final YamlConfiguration worldConfiguration,
|
||||
@WorldFile @Nonnull final File worldFile,
|
||||
@Nonnull final SetupUtils setupUtils,
|
||||
@Nonnull final GlobalBlockQueue globalBlockQueue,
|
||||
@Nonnull final WorldUtil worldUtil) {
|
||||
this.plotAreaManager = plotAreaManager;
|
||||
this.worldConfiguration = worldConfiguration;
|
||||
this.worldFile = worldFile;
|
||||
|
@ -25,6 +25,7 @@
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.location.Location;
|
||||
@ -44,7 +45,7 @@ import com.plotsquared.core.util.task.RunnableVal2;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
@ -60,9 +61,18 @@ import java.util.Set;
|
||||
public class Trim extends SubCommand {
|
||||
|
||||
private final PlotAreaManager plotAreaManager;
|
||||
private final WorldUtil worldUtil;
|
||||
private final GlobalBlockQueue blockQueue;
|
||||
private final RegionManager regionManager;
|
||||
|
||||
public Trim(@NotNull final PlotAreaManager plotAreaManager) {
|
||||
@Inject public Trim(@Nonnull final PlotAreaManager plotAreaManager,
|
||||
@Nonnull final WorldUtil worldUtil,
|
||||
@Nonnull final GlobalBlockQueue blockQueue,
|
||||
@Nonnull final RegionManager regionManager) {
|
||||
this.plotAreaManager = plotAreaManager;
|
||||
this.worldUtil = worldUtil;
|
||||
this.blockQueue = blockQueue;
|
||||
this.regionManager = regionManager;
|
||||
}
|
||||
|
||||
private static volatile boolean TASK = false;
|
||||
@ -84,7 +94,7 @@ public class Trim extends SubCommand {
|
||||
if (ExpireManager.IMP != null) {
|
||||
plots.removeAll(ExpireManager.IMP.getPendingExpired());
|
||||
}
|
||||
result.value1 = new HashSet<>(RegionManager.manager.getChunkChunks(world));
|
||||
result.value1 = new HashSet<>(PlotSquared.platform().getRegionManager().getChunkChunks(world));
|
||||
result.value2 = new HashSet<>();
|
||||
MainUtil.sendMessage(null, " - MCA #: " + result.value1.size());
|
||||
MainUtil.sendMessage(null, " - CHUNKS: " + (result.value1.size() * 1024) + " (max)");
|
||||
@ -116,7 +126,7 @@ public class Trim extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
final String world = args[0];
|
||||
if (!WorldUtil.IMP.isWorld(world) || !this.plotAreaManager.hasPlotArea(world)) {
|
||||
if (!this.worldUtil.isWorld(world) || !this.plotAreaManager.hasPlotArea(world)) {
|
||||
MainUtil.sendMessage(player, Captions.NOT_VALID_WORLD);
|
||||
return false;
|
||||
}
|
||||
@ -174,8 +184,7 @@ public class Trim extends SubCommand {
|
||||
}
|
||||
}
|
||||
}
|
||||
final LocalBlockQueue queue =
|
||||
GlobalBlockQueue.IMP.getNewQueue(world, false);
|
||||
final LocalBlockQueue queue = blockQueue.getNewQueue(world, false);
|
||||
TaskManager.objectTask(chunks, new RunnableVal<BlockVector2>() {
|
||||
@Override public void run(BlockVector2 value) {
|
||||
queue.regenChunk(value.getX(), value.getZ());
|
||||
@ -189,7 +198,7 @@ public class Trim extends SubCommand {
|
||||
player.sendMessage("Trim done!");
|
||||
};
|
||||
}
|
||||
RegionManager.manager.deleteRegionFiles(world, viable, regenTask);
|
||||
regionManager.deleteRegionFiles(world, viable, regenTask);
|
||||
|
||||
}
|
||||
});
|
||||
|
@ -25,6 +25,7 @@
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.database.DBFunc;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
@ -35,7 +36,7 @@ import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.TabCompletions;
|
||||
import com.plotsquared.core.util.task.RunnableVal2;
|
||||
import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@ -54,7 +55,7 @@ public class Trust extends Command {
|
||||
|
||||
private final EventDispatcher eventDispatcher;
|
||||
|
||||
public Trust(@NotNull final EventDispatcher eventDispatcher) {
|
||||
@Inject public Trust(@Nonnull final EventDispatcher eventDispatcher) {
|
||||
super(MainCommand.getInstance(), true);
|
||||
this.eventDispatcher = eventDispatcher;
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.events.PlotUnlinkEvent;
|
||||
import com.plotsquared.core.events.Result;
|
||||
@ -36,7 +37,7 @@ import com.plotsquared.core.util.MainUtil;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import com.plotsquared.core.util.StringMan;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@CommandDeclaration(command = "unlink",
|
||||
aliases = {"u", "unmerge"},
|
||||
@ -49,7 +50,7 @@ public class Unlink extends SubCommand {
|
||||
|
||||
private final EventDispatcher eventDispatcher;
|
||||
|
||||
public Unlink(@NotNull final EventDispatcher eventDispatcher) {
|
||||
@Inject public Unlink(@Nonnull final EventDispatcher eventDispatcher) {
|
||||
this.eventDispatcher = eventDispatcher;
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
*/
|
||||
package com.plotsquared.core.command;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.events.TeleportCause;
|
||||
@ -41,7 +42,7 @@ import com.plotsquared.core.util.query.PlotQuery;
|
||||
import com.plotsquared.core.util.query.SortingStrategy;
|
||||
import com.plotsquared.core.util.task.RunnableVal2;
|
||||
import com.plotsquared.core.util.task.RunnableVal3;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@ -62,17 +63,17 @@ public class Visit extends Command {
|
||||
|
||||
private final PlotAreaManager plotAreaManager;
|
||||
|
||||
public Visit(@NotNull final PlotAreaManager plotAreaManager) {
|
||||
@Inject public Visit(@Nonnull final PlotAreaManager plotAreaManager) {
|
||||
super(MainCommand.getInstance(), true);
|
||||
this.plotAreaManager = plotAreaManager;
|
||||
}
|
||||
|
||||
private void visit(@NotNull final PlotPlayer player, @NotNull final PlotQuery query, final PlotArea sortByArea,
|
||||
private void visit(@Nonnull final PlotPlayer player, @Nonnull final PlotQuery query, final PlotArea sortByArea,
|
||||
final RunnableVal3<Command, Runnable, Runnable> confirm, final RunnableVal2<Command, CommandResult> whenDone) {
|
||||
this.visit(player, query, sortByArea, confirm, whenDone, 1);
|
||||
}
|
||||
|
||||
private void visit(@NotNull final PlotPlayer player, @NotNull final PlotQuery query, final PlotArea sortByArea,
|
||||
private void visit(@Nonnull final PlotPlayer player, @Nonnull final PlotQuery query, final PlotArea sortByArea,
|
||||
final RunnableVal3<Command, Runnable, Runnable> confirm, final RunnableVal2<Command, CommandResult> whenDone, int page) {
|
||||
// We get the query once,
|
||||
// then we get it another time further on
|
||||
|
@ -30,7 +30,7 @@ import com.plotsquared.core.configuration.serialization.SerializableAs;
|
||||
import com.plotsquared.core.generator.ClassicPlotManagerComponent;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@ -63,7 +63,7 @@ public class ComponentPreset implements ConfigurationSerializable {
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
public static ComponentPreset deserialize(@NotNull final Map<String, Object> map) {
|
||||
public static ComponentPreset deserialize(@Nonnull final Map<String, Object> map) {
|
||||
final ClassicPlotManagerComponent classicPlotManagerComponent = ClassicPlotManagerComponent
|
||||
.fromString(map.getOrDefault("component", "").toString()).orElseThrow(() ->
|
||||
new IllegalArgumentException("The preset needs a valid target component"));
|
||||
|
@ -44,8 +44,8 @@ import com.plotsquared.core.util.PatternUtil;
|
||||
import com.plotsquared.core.util.Permissions;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -64,7 +64,7 @@ public class ComponentPresetManager {
|
||||
private final EconHandler econHandler;
|
||||
private final InventoryUtil inventoryUtil;
|
||||
|
||||
@Inject public ComponentPresetManager(@Nullable final EconHandler econHandler, @NotNull final
|
||||
@Inject public ComponentPresetManager(@Nullable final EconHandler econHandler, @Nonnull final
|
||||
InventoryUtil inventoryUtil) {
|
||||
this.econHandler = econHandler;
|
||||
this.inventoryUtil = inventoryUtil;
|
||||
|
@ -31,7 +31,9 @@ import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
/**
|
||||
* Main Configuration Utility
|
||||
@ -104,7 +106,7 @@ public class ConfigurationUtil {
|
||||
|
||||
@Getter private final String unknownValue;
|
||||
|
||||
UnknownBlockException(@NonNull final String unknownValue) {
|
||||
UnknownBlockException(@Nonnull final String unknownValue) {
|
||||
super(String.format("\"%s\" is not a valid block", unknownValue));
|
||||
this.unknownValue = unknownValue;
|
||||
}
|
||||
@ -137,7 +139,7 @@ public class ConfigurationUtil {
|
||||
|
||||
@Getter private final BlockState unsafeBlock;
|
||||
|
||||
UnsafeBlockException(@NonNull final BlockState unsafeBlock) {
|
||||
UnsafeBlockException(@Nonnull final BlockState unsafeBlock) {
|
||||
super(String.format("%s is not a valid block", unsafeBlock));
|
||||
this.unsafeBlock = unsafeBlock;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ import com.plotsquared.core.plot.PlotId;
|
||||
import com.plotsquared.core.plot.comment.PlotComment;
|
||||
import com.plotsquared.core.plot.flag.PlotFlag;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -345,7 +345,7 @@ public interface AbstractDB {
|
||||
*
|
||||
* @param plot The Plot to get comments from
|
||||
*/
|
||||
void getComments(@NotNull Plot plot, String inbox, RunnableVal<List<PlotComment>> whenDone);
|
||||
void getComments(@Nonnull Plot plot, String inbox, RunnableVal<List<PlotComment>> whenDone);
|
||||
|
||||
void createPlotAndSettings(Plot plot, Runnable whenDone);
|
||||
|
||||
|
@ -51,7 +51,7 @@ import com.plotsquared.core.util.MainUtil;
|
||||
import com.plotsquared.core.util.StringMan;
|
||||
import com.plotsquared.core.util.task.RunnableVal;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
@ -144,11 +144,11 @@ public class SQLManager implements AbstractDB {
|
||||
* @throws SQLException
|
||||
* @throws ClassNotFoundException
|
||||
*/
|
||||
public SQLManager(@NotNull final Database database,
|
||||
@NotNull final String prefix,
|
||||
@NotNull final EventDispatcher eventDispatcher,
|
||||
@NotNull final PlotListener plotListener,
|
||||
@WorldConfig @NotNull final YamlConfiguration worldConfiguration)
|
||||
public SQLManager(@Nonnull final Database database,
|
||||
@Nonnull final String prefix,
|
||||
@Nonnull final EventDispatcher eventDispatcher,
|
||||
@Nonnull final PlotListener plotListener,
|
||||
@WorldConfig @Nonnull final YamlConfiguration worldConfiguration)
|
||||
throws SQLException, ClassNotFoundException {
|
||||
// Private final
|
||||
this.eventDispatcher = eventDispatcher;
|
||||
@ -265,7 +265,7 @@ public class SQLManager implements AbstractDB {
|
||||
return this.notifyTasks;
|
||||
}
|
||||
|
||||
public synchronized void addPlotTask(@NotNull Plot plot, UniqueStatement task) {
|
||||
public synchronized void addPlotTask(@Nonnull Plot plot, UniqueStatement task) {
|
||||
Queue<UniqueStatement> tasks = this.plotTasks.get(plot);
|
||||
if (tasks == null) {
|
||||
tasks = new ConcurrentLinkedQueue<>();
|
||||
@ -2390,7 +2390,7 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getComments(@NotNull Plot plot, final String inbox,
|
||||
public void getComments(@Nonnull Plot plot, final String inbox,
|
||||
final RunnableVal<List<PlotComment>> whenDone) {
|
||||
addPlotTask(plot, new UniqueStatement("getComments_" + plot) {
|
||||
@Override public void set(PreparedStatement statement) throws SQLException {
|
||||
|
@ -28,7 +28,7 @@ package com.plotsquared.core.events;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.PlotId;
|
||||
import lombok.Getter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@ -50,8 +50,8 @@ public final class PlotAutoMergeEvent extends PlotEvent implements CancellablePl
|
||||
* @param plot Plot that was merged
|
||||
* @param plots A list of plots involved in the event
|
||||
*/
|
||||
public PlotAutoMergeEvent(@NotNull final String world, @NotNull final Plot plot,
|
||||
@NotNull final List<PlotId> plots) {
|
||||
public PlotAutoMergeEvent(@Nonnull final String world, @Nonnull final Plot plot,
|
||||
@Nonnull final List<PlotId> plots) {
|
||||
super(plot);
|
||||
this.world = world;
|
||||
this.plots = plots;
|
||||
|
@ -28,7 +28,7 @@ package com.plotsquared.core.events;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.PlotId;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
package com.plotsquared.core.events;
|
||||
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public abstract class PlotEvent {
|
||||
|
||||
@ -51,7 +51,7 @@ public abstract class PlotEvent {
|
||||
*
|
||||
* @return the event class name
|
||||
*/
|
||||
@NotNull public String getEventName() {
|
||||
@Nonnull public String getEventName() {
|
||||
if (name == null) {
|
||||
name = getClass().getSimpleName();
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Event called when several plots are merged
|
||||
@ -53,8 +53,8 @@ public final class PlotMergeEvent extends PlotPlayerEvent implements Cancellable
|
||||
* @param max Max merge size
|
||||
* @param player The player attempting the merge
|
||||
*/
|
||||
public PlotMergeEvent(@NotNull final String world, @NotNull final Plot plot,
|
||||
@NotNull final Direction dir, final int max, PlotPlayer player) {
|
||||
public PlotMergeEvent(@Nonnull final String world, @Nonnull final Plot plot,
|
||||
@Nonnull final Direction dir, final int max, PlotPlayer player) {
|
||||
super(player, plot);
|
||||
this.world = world;
|
||||
this.dir = dir;
|
||||
|
@ -28,7 +28,7 @@ package com.plotsquared.core.events;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.Rating;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class PlotRateEvent extends PlotEvent implements CancellablePlotEvent {
|
||||
|
||||
|
@ -29,7 +29,7 @@ import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Event called when several merged plots are unlinked
|
||||
@ -52,7 +52,7 @@ public final class PlotUnlinkEvent extends PlotEvent implements CancellablePlotE
|
||||
* @param createSign Whether to regenerate signs
|
||||
* @param reason The {@link REASON} for the unlink
|
||||
*/
|
||||
public PlotUnlinkEvent(@NotNull final PlotArea area, Plot plot, boolean createRoad,
|
||||
public PlotUnlinkEvent(@Nonnull final PlotArea area, Plot plot, boolean createRoad,
|
||||
boolean createSign, REASON reason) {
|
||||
super(plot);
|
||||
this.area = area;
|
||||
|
@ -39,8 +39,8 @@ import com.plotsquared.core.util.RegionUtil;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@ -54,7 +54,7 @@ public class AugmentedUtils {
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
public static boolean generate(@Nullable Object chunkObject, @NotNull final String world,
|
||||
public static boolean generate(@Nullable Object chunkObject, @Nonnull final String world,
|
||||
final int chunkX, final int chunkZ, LocalBlockQueue queue) {
|
||||
if (!enabled) {
|
||||
return false;
|
||||
|
@ -40,7 +40,7 @@ import com.plotsquared.core.util.RegionManager;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@ -53,8 +53,8 @@ public class ClassicPlotManager extends SquarePlotManager {
|
||||
private final ClassicPlotWorld classicPlotWorld;
|
||||
private final RegionManager regionManager;
|
||||
|
||||
public ClassicPlotManager(@NotNull final ClassicPlotWorld classicPlotWorld,
|
||||
@NotNull final RegionManager regionManager) {
|
||||
public ClassicPlotManager(@Nonnull final ClassicPlotWorld classicPlotWorld,
|
||||
@Nonnull final RegionManager regionManager) {
|
||||
super(classicPlotWorld, regionManager);
|
||||
this.classicPlotWorld = classicPlotWorld;
|
||||
this.regionManager = regionManager;
|
||||
|
@ -25,7 +25,7 @@
|
||||
*/
|
||||
package com.plotsquared.core.generator;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@ -51,7 +51,7 @@ public enum ClassicPlotManagerComponent {
|
||||
return stringValues;
|
||||
}
|
||||
|
||||
public static Optional<ClassicPlotManagerComponent> fromString(@NotNull final String string) {
|
||||
public static Optional<ClassicPlotManagerComponent> fromString(@Nonnull final String string) {
|
||||
for (final ClassicPlotManagerComponent classicPlotManagerComponent : values()) {
|
||||
if (classicPlotManagerComponent.name().equalsIgnoreCase(string)) {
|
||||
return Optional.of(classicPlotManagerComponent);
|
||||
|
@ -35,8 +35,8 @@ 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 org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@SuppressWarnings("WeakerAccess")
|
||||
public abstract class ClassicPlotWorld extends SquarePlotWorld {
|
||||
@ -58,13 +58,13 @@ public abstract class ClassicPlotWorld extends SquarePlotWorld {
|
||||
// BlockUtil.get((short) 155, (byte) 0);
|
||||
public boolean PLOT_BEDROCK = true;
|
||||
|
||||
public ClassicPlotWorld(@NotNull final String worldName,
|
||||
public ClassicPlotWorld(@Nonnull final String worldName,
|
||||
@Nullable final String id,
|
||||
@NotNull final IndependentPlotGenerator generator,
|
||||
@NotNull final PlotId min,
|
||||
@NotNull final PlotId max,
|
||||
@WorldConfig @NotNull final YamlConfiguration worldConfiguration,
|
||||
@NotNull final GlobalBlockQueue blockQueue,
|
||||
@Nonnull final IndependentPlotGenerator generator,
|
||||
@Nonnull final PlotId min,
|
||||
@Nonnull 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);
|
||||
}
|
||||
@ -76,7 +76,7 @@ public abstract class ClassicPlotWorld extends SquarePlotWorld {
|
||||
* command - this may be useful if a config value can be changed at a later date, and has no impact on the actual
|
||||
* world generation</p>
|
||||
*/
|
||||
@NotNull @Override public ConfigurationNode[] getSettingNodes() {
|
||||
@Nonnull @Override public ConfigurationNode[] getSettingNodes() {
|
||||
return new ConfigurationNode[] {
|
||||
new ConfigurationNode("plot.height", this.PLOT_HEIGHT, "Plot height",
|
||||
ConfigurationUtil.INTEGER),
|
||||
|
@ -31,16 +31,16 @@ 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 org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public abstract class GridPlotWorld extends PlotArea {
|
||||
|
||||
public short SIZE;
|
||||
|
||||
public GridPlotWorld(String worldName, String id, @NotNull IndependentPlotGenerator generator,
|
||||
PlotId min, PlotId max, @WorldConfig @NotNull final YamlConfiguration worldConfiguration,
|
||||
@NotNull final GlobalBlockQueue blockQueue,
|
||||
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);
|
||||
}
|
||||
|
@ -38,13 +38,13 @@ import com.plotsquared.core.util.MathMan;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class HybridGen extends IndependentPlotGenerator {
|
||||
|
||||
private final HybridPlotWorldFactory hybridPlotWorldFactory;
|
||||
|
||||
@Inject public HybridGen(@NotNull final HybridPlotWorldFactory hybridPlotWorldFactory) {
|
||||
@Inject public HybridGen(@Nonnull final HybridPlotWorldFactory hybridPlotWorldFactory) {
|
||||
this.hybridPlotWorldFactory = hybridPlotWorldFactory;
|
||||
}
|
||||
|
||||
@ -76,7 +76,7 @@ public class HybridGen extends IndependentPlotGenerator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateChunk(@NotNull ScopedLocalBlockQueue result, @NotNull PlotArea settings) {
|
||||
public void generateChunk(@Nonnull ScopedLocalBlockQueue result, @Nonnull PlotArea settings) {
|
||||
Preconditions.checkNotNull(result, "result cannot be null");
|
||||
Preconditions.checkNotNull(settings, "settings cannot be null");
|
||||
|
||||
|
@ -47,7 +47,7 @@ import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import lombok.Getter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -61,8 +61,8 @@ public class HybridPlotManager extends ClassicPlotManager {
|
||||
@Getter private final HybridPlotWorld hybridPlotWorld;
|
||||
private final RegionManager regionManager;
|
||||
|
||||
public HybridPlotManager(@NotNull final HybridPlotWorld hybridPlotWorld,
|
||||
@NotNull final RegionManager regionManager) {
|
||||
public HybridPlotManager(@Nonnull final HybridPlotWorld hybridPlotWorld,
|
||||
@Nonnull final RegionManager regionManager) {
|
||||
super(hybridPlotWorld, regionManager);
|
||||
this.hybridPlotWorld = hybridPlotWorld;
|
||||
this.regionManager = regionManager;
|
||||
|
@ -57,8 +57,8 @@ import com.sk89q.worldedit.util.Direction;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import lombok.Getter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.io.File;
|
||||
@ -83,15 +83,15 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
||||
private final RegionManager regionManager;
|
||||
private final SchematicHandler schematicHandler;
|
||||
|
||||
@Inject public HybridPlotWorld(@Assisted final String worldName,
|
||||
@Assisted final String id,
|
||||
@Assisted @NotNull final IndependentPlotGenerator generator,
|
||||
@Assisted final PlotId min,
|
||||
@Assisted final PlotId max,
|
||||
@WorldConfig @NotNull final YamlConfiguration worldConfiguration,
|
||||
@NotNull final RegionManager regionManager,
|
||||
@NotNull final SchematicHandler schematicHandler,
|
||||
@NotNull final GlobalBlockQueue blockQueue,
|
||||
@Inject public HybridPlotWorld(@Assisted("world") final String worldName,
|
||||
@Nullable @Assisted("id") final String id,
|
||||
@Assisted @Nonnull final IndependentPlotGenerator generator,
|
||||
@Nullable @Assisted("min") final PlotId min,
|
||||
@Nullable @Assisted("max") final PlotId max,
|
||||
@WorldConfig @Nonnull final YamlConfiguration worldConfiguration,
|
||||
@Nonnull final RegionManager regionManager,
|
||||
@Nonnull final SchematicHandler schematicHandler,
|
||||
@Nonnull final GlobalBlockQueue blockQueue,
|
||||
@Nullable final EconHandler econHandler) {
|
||||
super(worldName, id, generator, min, max, worldConfiguration, blockQueue, econHandler);
|
||||
this.regionManager = regionManager;
|
||||
@ -145,11 +145,11 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
||||
return BlockTransformExtent.transform(id, transform);
|
||||
}
|
||||
|
||||
@NotNull @Override protected PlotManager createManager() {
|
||||
@Nonnull @Override protected PlotManager createManager() {
|
||||
return new HybridPlotManager(this, this.regionManager);
|
||||
}
|
||||
|
||||
public Location getSignLocation(@NotNull Plot plot) {
|
||||
public Location getSignLocation(@Nonnull Plot plot) {
|
||||
plot = plot.getBasePlot(false);
|
||||
final Location bot = plot.getBottomAbs();
|
||||
if (SIGN_LOCATION == null) {
|
||||
@ -206,7 +206,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
||||
}
|
||||
}
|
||||
|
||||
@Override public boolean isCompatible(@NotNull final PlotArea plotArea) {
|
||||
@Override public boolean isCompatible(@Nonnull final PlotArea plotArea) {
|
||||
if (!(plotArea instanceof SquarePlotWorld)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayDeque;
|
||||
@ -92,9 +92,9 @@ public class HybridUtils {
|
||||
private final RegionManager regionManager;
|
||||
private final SchematicHandler schematicHandler;
|
||||
|
||||
@Inject public HybridUtils(@NotNull final PlotAreaManager plotAreaManager,
|
||||
@NotNull final ChunkManager chunkManager, @NotNull final GlobalBlockQueue blockQueue,
|
||||
@NotNull final WorldUtil worldUtil, @NotNull final RegionManager regionManager, @NotNull final SchematicHandler schematicHandler) {
|
||||
@Inject public HybridUtils(@Nonnull final PlotAreaManager plotAreaManager,
|
||||
@Nonnull final ChunkManager chunkManager, @Nonnull final GlobalBlockQueue blockQueue,
|
||||
@Nonnull final WorldUtil worldUtil, @Nonnull final RegionManager regionManager, @Nonnull final SchematicHandler schematicHandler) {
|
||||
this.plotAreaManager = plotAreaManager;
|
||||
this.chunkManager = chunkManager;
|
||||
this.blockQueue = blockQueue;
|
||||
|
@ -35,7 +35,7 @@ import com.plotsquared.core.plot.world.SinglePlotAreaManager;
|
||||
import com.plotsquared.core.queue.ScopedLocalBlockQueue;
|
||||
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class SingleWorldGenerator extends IndependentPlotGenerator {
|
||||
|
||||
@ -48,7 +48,7 @@ public class SingleWorldGenerator extends IndependentPlotGenerator {
|
||||
|
||||
private final PlotAreaManager plotAreaManager;
|
||||
|
||||
@Inject public SingleWorldGenerator(@NotNull final PlotAreaManager plotAreaManager) {
|
||||
@Inject public SingleWorldGenerator(@Nonnull final PlotAreaManager plotAreaManager) {
|
||||
this.plotAreaManager = plotAreaManager;
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ import com.plotsquared.core.plot.PlotId;
|
||||
import com.plotsquared.core.util.MainUtil;
|
||||
import com.plotsquared.core.util.RegionManager;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
@ -48,7 +48,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
|
||||
private final SquarePlotWorld squarePlotWorld;
|
||||
private final RegionManager regionManager;
|
||||
|
||||
public SquarePlotManager(@NotNull final SquarePlotWorld squarePlotWorld, @NotNull final RegionManager regionManager) {
|
||||
public SquarePlotManager(@Nonnull final SquarePlotWorld squarePlotWorld, @Nonnull final RegionManager regionManager) {
|
||||
super(squarePlotWorld);
|
||||
this.squarePlotWorld = squarePlotWorld;
|
||||
this.regionManager = regionManager;
|
||||
|
@ -32,8 +32,8 @@ 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.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public abstract class SquarePlotWorld extends GridPlotWorld {
|
||||
|
||||
@ -44,11 +44,11 @@ public abstract class SquarePlotWorld extends GridPlotWorld {
|
||||
|
||||
public SquarePlotWorld(final String worldName,
|
||||
@Nullable final String id,
|
||||
@NotNull final IndependentPlotGenerator generator,
|
||||
@Nonnull final IndependentPlotGenerator generator,
|
||||
@Nullable final PlotId min,
|
||||
@Nullable final PlotId max,
|
||||
@WorldConfig @NotNull final YamlConfiguration worldConfiguration,
|
||||
@NotNull final GlobalBlockQueue blockQueue,
|
||||
@WorldConfig @Nonnull final YamlConfiguration worldConfiguration,
|
||||
@Nonnull final GlobalBlockQueue blockQueue,
|
||||
@Nullable final EconHandler econHandler) {
|
||||
super(worldName, id, generator, min, max, worldConfiguration, blockQueue, econHandler);
|
||||
}
|
||||
|
@ -25,6 +25,8 @@
|
||||
*/
|
||||
package com.plotsquared.core.inject.annotations;
|
||||
|
||||
import com.google.inject.BindingAnnotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
@ -32,5 +34,6 @@ import java.lang.annotation.Target;
|
||||
|
||||
@Target({ElementType.PARAMETER, ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@BindingAnnotation
|
||||
public @interface BackgroundPipeline {
|
||||
}
|
||||
|
@ -25,6 +25,8 @@
|
||||
*/
|
||||
package com.plotsquared.core.inject.annotations;
|
||||
|
||||
import com.google.inject.BindingAnnotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
@ -32,5 +34,6 @@ import java.lang.annotation.Target;
|
||||
|
||||
@Target(ElementType.PARAMETER)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@BindingAnnotation
|
||||
public @interface ConfigFile {
|
||||
}
|
||||
|
@ -25,6 +25,8 @@
|
||||
*/
|
||||
package com.plotsquared.core.inject.annotations;
|
||||
|
||||
import com.google.inject.BindingAnnotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
@ -32,5 +34,6 @@ import java.lang.annotation.Target;
|
||||
|
||||
@Target(ElementType.PARAMETER)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@BindingAnnotation
|
||||
public @interface ConsoleActor {
|
||||
}
|
||||
|
@ -25,6 +25,8 @@
|
||||
*/
|
||||
package com.plotsquared.core.inject.annotations;
|
||||
|
||||
import com.google.inject.BindingAnnotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
@ -32,5 +34,6 @@ import java.lang.annotation.Target;
|
||||
|
||||
@Target({ElementType.PARAMETER, ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@BindingAnnotation
|
||||
public @interface DefaultGenerator {
|
||||
}
|
||||
|
@ -25,6 +25,8 @@
|
||||
*/
|
||||
package com.plotsquared.core.inject.annotations;
|
||||
|
||||
import com.google.inject.BindingAnnotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
@ -32,5 +34,6 @@ import java.lang.annotation.Target;
|
||||
|
||||
@Target({ElementType.PARAMETER, ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@BindingAnnotation
|
||||
public @interface ImpromptuPipeline {
|
||||
}
|
||||
|
@ -25,6 +25,8 @@
|
||||
*/
|
||||
package com.plotsquared.core.inject.annotations;
|
||||
|
||||
import com.google.inject.BindingAnnotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
@ -32,5 +34,6 @@ import java.lang.annotation.Target;
|
||||
|
||||
@Target({ElementType.PARAMETER, ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@BindingAnnotation
|
||||
public @interface WorldConfig {
|
||||
}
|
||||
|
@ -25,6 +25,8 @@
|
||||
*/
|
||||
package com.plotsquared.core.inject.annotations;
|
||||
|
||||
import com.google.inject.BindingAnnotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
@ -32,5 +34,6 @@ import java.lang.annotation.Target;
|
||||
|
||||
@Target({ElementType.PARAMETER, ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@BindingAnnotation
|
||||
public @interface WorldFile {
|
||||
}
|
||||
|
@ -25,15 +25,19 @@
|
||||
*/
|
||||
package com.plotsquared.core.inject.factory;
|
||||
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import com.plotsquared.core.generator.HybridPlotWorld;
|
||||
import com.plotsquared.core.generator.IndependentPlotGenerator;
|
||||
import com.plotsquared.core.plot.PlotId;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public interface HybridPlotWorldFactory {
|
||||
|
||||
@NotNull HybridPlotWorld create(@NotNull String worldName, @Nullable String id,
|
||||
@NotNull IndependentPlotGenerator plotGenerator, @Nullable PlotId min, @Nullable PlotId max);
|
||||
@Nonnull HybridPlotWorld create(@Nonnull @Assisted("world") String worldName,
|
||||
@Nullable @Assisted("id") String id,
|
||||
@Nonnull IndependentPlotGenerator plotGenerator,
|
||||
@Nullable @Assisted("min") PlotId min,
|
||||
@Nullable @Assisted("max") PlotId max);
|
||||
|
||||
}
|
||||
|
@ -27,12 +27,12 @@ package com.plotsquared.core.inject.factory;
|
||||
|
||||
import com.plotsquared.core.backup.PlayerBackupProfile;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public interface PlayerBackupProfileFactory {
|
||||
|
||||
@NotNull PlayerBackupProfile create(@NotNull UUID uuid, @NotNull Plot plot);
|
||||
@Nonnull PlayerBackupProfile create(@Nonnull UUID uuid, @Nonnull Plot plot);
|
||||
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ import com.sk89q.worldedit.world.gamemode.GameMode;
|
||||
import com.sk89q.worldedit.world.gamemode.GameModes;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
@ -44,7 +44,7 @@ import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashMap;
|
||||
@ -64,7 +64,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
||||
private Extent parent;
|
||||
private Map<Long, Integer[]> tileEntityCount = new HashMap<>();
|
||||
|
||||
public ProcessedWEExtent(String world, Set<CuboidRegion> mask, int max, Extent child, Extent parent, @NotNull final WorldUtil worldUtil) {
|
||||
public ProcessedWEExtent(String world, Set<CuboidRegion> mask, int max, Extent child, Extent parent, @Nonnull final WorldUtil worldUtil) {
|
||||
super(child);
|
||||
this.mask = mask;
|
||||
this.world = world;
|
||||
|
@ -45,7 +45,7 @@ import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.eventbus.EventHandler.Priority;
|
||||
import com.sk89q.worldedit.util.eventbus.Subscribe;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@ -54,7 +54,7 @@ public class WESubscriber {
|
||||
private final PlotAreaManager plotAreaManager;
|
||||
private final WorldUtil worldUtil;
|
||||
|
||||
@Inject public WESubscriber(@NotNull final PlotAreaManager plotAreaManager, @NotNull final WorldUtil worldUtil) {
|
||||
@Inject public WESubscriber(@Nonnull final PlotAreaManager plotAreaManager, @Nonnull final WorldUtil worldUtil) {
|
||||
this.plotAreaManager = plotAreaManager;
|
||||
this.worldUtil = worldUtil;
|
||||
}
|
||||
|
@ -33,11 +33,12 @@ import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.khelekore.prtree.MBR;
|
||||
import org.khelekore.prtree.SimpleMBR;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* An unmodifiable 6-tuple (world,x,y,z,yaw,pitch)
|
||||
*/
|
||||
@ -49,7 +50,7 @@ public final class Location implements Comparable<Location> {
|
||||
@Getter private final BlockVector3 blockVector3;
|
||||
private final World<?> world;
|
||||
|
||||
private Location(@NotNull final World<?> world, @NotNull final BlockVector3 blockVector3,
|
||||
private Location(@Nonnull final World<?> world, @Nonnull final BlockVector3 blockVector3,
|
||||
final float yaw, final float pitch) {
|
||||
this.world = Preconditions.checkNotNull(world, "World may not be null");
|
||||
this.blockVector3 = Preconditions.checkNotNull(blockVector3, "Vector may not be null");
|
||||
@ -57,7 +58,7 @@ public final class Location implements Comparable<Location> {
|
||||
this.pitch = pitch;
|
||||
}
|
||||
|
||||
private Location(@NotNull final String worldName, @NotNull final BlockVector3 blockVector3,
|
||||
private Location(@Nonnull final String worldName, @Nonnull final BlockVector3 blockVector3,
|
||||
final float yaw, final float pitch) {
|
||||
Preconditions.checkNotNull(worldName, "World name may not be null");
|
||||
if (worldName.isEmpty()) {
|
||||
@ -79,8 +80,8 @@ public final class Location implements Comparable<Location> {
|
||||
* @param pitch pitch
|
||||
* @return New location
|
||||
*/
|
||||
@NotNull public static Location at(@NotNull final String world,
|
||||
@NotNull final BlockVector3 blockVector3, final float yaw, final float pitch) {
|
||||
@Nonnull public static Location at(@Nonnull final String world,
|
||||
@Nonnull final BlockVector3 blockVector3, final float yaw, final float pitch) {
|
||||
return new Location(world, blockVector3, yaw, pitch);
|
||||
}
|
||||
|
||||
@ -91,8 +92,8 @@ public final class Location implements Comparable<Location> {
|
||||
* @param blockVector3 (x,y,z) vector
|
||||
* @return New location
|
||||
*/
|
||||
@NotNull public static Location at(@NotNull final String world,
|
||||
@NotNull final BlockVector3 blockVector3) {
|
||||
@Nonnull public static Location at(@Nonnull final String world,
|
||||
@Nonnull final BlockVector3 blockVector3) {
|
||||
return at(world, blockVector3, 0f, 0f);
|
||||
}
|
||||
|
||||
@ -107,7 +108,7 @@ public final class Location implements Comparable<Location> {
|
||||
* @param pitch Pitch
|
||||
* @return New location
|
||||
*/
|
||||
@NotNull public static Location at(@NotNull final String world, final int x, final int y,
|
||||
@Nonnull public static Location at(@Nonnull final String world, final int x, final int y,
|
||||
final int z, final float yaw, final float pitch) {
|
||||
return at(world, BlockVector3.at(x, y, z), yaw, pitch);
|
||||
}
|
||||
@ -121,7 +122,7 @@ public final class Location implements Comparable<Location> {
|
||||
* @param z Z coordinate
|
||||
* @return New location
|
||||
*/
|
||||
@NotNull public static Location at(@NotNull final String world, final int x, final int y,
|
||||
@Nonnull public static Location at(@Nonnull final String world, final int x, final int y,
|
||||
final int z) {
|
||||
return at(world, BlockVector3.at(x, y, z));
|
||||
}
|
||||
@ -135,8 +136,8 @@ public final class Location implements Comparable<Location> {
|
||||
* @param pitch pitch
|
||||
* @return New location
|
||||
*/
|
||||
@NotNull public static Location at(@NotNull final World<?> world,
|
||||
@NotNull final BlockVector3 blockVector3, final float yaw, final float pitch) {
|
||||
@Nonnull public static Location at(@Nonnull final World<?> world,
|
||||
@Nonnull final BlockVector3 blockVector3, final float yaw, final float pitch) {
|
||||
return new Location(world, blockVector3, yaw, pitch);
|
||||
}
|
||||
|
||||
@ -147,8 +148,8 @@ public final class Location implements Comparable<Location> {
|
||||
* @param blockVector3 (x,y,z) vector
|
||||
* @return New location
|
||||
*/
|
||||
@NotNull public static Location at(@NotNull final World<?> world,
|
||||
@NotNull final BlockVector3 blockVector3) {
|
||||
@Nonnull public static Location at(@Nonnull final World<?> world,
|
||||
@Nonnull final BlockVector3 blockVector3) {
|
||||
return at(world, blockVector3, 0f, 0f);
|
||||
}
|
||||
|
||||
@ -163,7 +164,7 @@ public final class Location implements Comparable<Location> {
|
||||
* @param pitch Pitch
|
||||
* @return New location
|
||||
*/
|
||||
@NotNull public static Location at(@NotNull final World<?> world, final int x, final int y,
|
||||
@Nonnull public static Location at(@Nonnull final World<?> world, final int x, final int y,
|
||||
final int z, final float yaw, final float pitch) {
|
||||
return at(world, BlockVector3.at(x, y, z), yaw, pitch);
|
||||
}
|
||||
@ -177,7 +178,7 @@ public final class Location implements Comparable<Location> {
|
||||
* @param z Z coordinate
|
||||
* @return New location
|
||||
*/
|
||||
@NotNull public static Location at(@NotNull final World<?> world, final int x, final int y,
|
||||
@Nonnull public static Location at(@Nonnull final World<?> world, final int x, final int y,
|
||||
final int z) {
|
||||
return at(world, BlockVector3.at(x, y, z));
|
||||
}
|
||||
@ -187,7 +188,7 @@ public final class Location implements Comparable<Location> {
|
||||
*
|
||||
* @return World object
|
||||
*/
|
||||
@NotNull public World<?> getWorld() {
|
||||
@Nonnull public World<?> getWorld() {
|
||||
return this.world;
|
||||
}
|
||||
|
||||
@ -196,7 +197,7 @@ public final class Location implements Comparable<Location> {
|
||||
*
|
||||
* @return World name
|
||||
*/
|
||||
@NotNull public String getWorldName() {
|
||||
@Nonnull public String getWorldName() {
|
||||
return this.world.getName();
|
||||
}
|
||||
|
||||
@ -326,7 +327,7 @@ public final class Location implements Comparable<Location> {
|
||||
*
|
||||
* @return Chunk coordinates
|
||||
*/
|
||||
@NotNull public BlockVector2 getChunkLocation() {
|
||||
@Nonnull public BlockVector2 getChunkLocation() {
|
||||
return BlockVector2.at(this.getX() >> 4, this.getZ() >> 4);
|
||||
}
|
||||
|
||||
@ -338,7 +339,7 @@ public final class Location implements Comparable<Location> {
|
||||
* @param z Z offset
|
||||
* @return New location
|
||||
*/
|
||||
@NotNull public Location add(final int x, final int y, final int z) {
|
||||
@Nonnull public Location add(final int x, final int y, final int z) {
|
||||
return new Location(this.world, this.blockVector3.add(x, y, z), this.yaw, this.pitch);
|
||||
}
|
||||
|
||||
@ -348,7 +349,7 @@ public final class Location implements Comparable<Location> {
|
||||
* @param x New X coordinate
|
||||
* @return New location
|
||||
*/
|
||||
@NotNull public Location withX(final int x) {
|
||||
@Nonnull public Location withX(final int x) {
|
||||
return new Location(this.world, this.blockVector3.withX(x), this.yaw, this.pitch);
|
||||
}
|
||||
|
||||
@ -358,7 +359,7 @@ public final class Location implements Comparable<Location> {
|
||||
* @param y New Y coordinate
|
||||
* @return New location
|
||||
*/
|
||||
@NotNull public Location withY(final int y) {
|
||||
@Nonnull public Location withY(final int y) {
|
||||
return new Location(this.world, this.blockVector3.withY(y), this.yaw, this.pitch);
|
||||
}
|
||||
|
||||
@ -368,7 +369,7 @@ public final class Location implements Comparable<Location> {
|
||||
* @param z New Z coordinate
|
||||
* @return New location
|
||||
*/
|
||||
@NotNull public Location withZ(final int z) {
|
||||
@Nonnull public Location withZ(final int z) {
|
||||
return new Location(this.world, this.blockVector3.withZ(z), this.yaw, this.pitch);
|
||||
}
|
||||
|
||||
@ -378,7 +379,7 @@ public final class Location implements Comparable<Location> {
|
||||
* @param yaw New yaw
|
||||
* @return New location
|
||||
*/
|
||||
@NotNull public Location withYaw(final float yaw) {
|
||||
@Nonnull public Location withYaw(final float yaw) {
|
||||
return new Location(this.world, this.blockVector3, yaw, this.pitch);
|
||||
}
|
||||
|
||||
@ -388,7 +389,7 @@ public final class Location implements Comparable<Location> {
|
||||
* @param pitch New pitch
|
||||
* @return New location
|
||||
*/
|
||||
@NotNull public Location withPitch(final float pitch) {
|
||||
@Nonnull public Location withPitch(final float pitch) {
|
||||
return new Location(this.world, this.blockVector3, this.yaw, pitch);
|
||||
}
|
||||
|
||||
@ -398,18 +399,18 @@ public final class Location implements Comparable<Location> {
|
||||
* @param world New world
|
||||
* @return New location
|
||||
*/
|
||||
@NotNull public Location withWorld(@NotNull final String world) {
|
||||
@Nonnull public Location withWorld(@Nonnull final String world) {
|
||||
return new Location(world, this.blockVector3, this.yaw, this.pitch);
|
||||
}
|
||||
|
||||
public double getEuclideanDistanceSquared(@NotNull final Location l2) {
|
||||
public double getEuclideanDistanceSquared(@Nonnull final Location l2) {
|
||||
double x = getX() - l2.getX();
|
||||
double y = getY() - l2.getY();
|
||||
double z = getZ() - l2.getZ();
|
||||
return x * x + y * y + z * z;
|
||||
}
|
||||
|
||||
public double getEuclideanDistance(@NotNull final Location l2) {
|
||||
public double getEuclideanDistance(@Nonnull final Location l2) {
|
||||
return Math.sqrt(getEuclideanDistanceSquared(l2));
|
||||
}
|
||||
|
||||
@ -421,7 +422,7 @@ public final class Location implements Comparable<Location> {
|
||||
* @param z Z offset
|
||||
* @return New location
|
||||
*/
|
||||
@NotNull public Location subtract(int x, int y, int z) {
|
||||
@Nonnull public Location subtract(int x, int y, int z) {
|
||||
return this.add(-x, -y, -z);
|
||||
}
|
||||
|
||||
@ -430,12 +431,12 @@ public final class Location implements Comparable<Location> {
|
||||
*
|
||||
* @return Minimum bounding rectangle
|
||||
*/
|
||||
@NotNull public MBR toMBR() {
|
||||
@Nonnull public MBR toMBR() {
|
||||
return new SimpleMBR(this.getX(), this.getX(), this.getY(), this.getY(), this.getZ(),
|
||||
this.getZ());
|
||||
}
|
||||
|
||||
@Override public int compareTo(@NotNull final Location o) {
|
||||
@Override public int compareTo(@Nonnull final Location o) {
|
||||
if (this.getX() == o.getX() && this.getY() == o.getY() || this.getZ() == o.getZ()) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ package com.plotsquared.core.location;
|
||||
|
||||
import com.plotsquared.core.util.StringMan;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
//todo better description needed
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
package com.plotsquared.core.location;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* PlotSquared representation of a platform world
|
||||
@ -40,14 +40,14 @@ public interface World<T> {
|
||||
*
|
||||
* @return Platform world
|
||||
*/
|
||||
@NotNull T getPlatformWorld();
|
||||
@Nonnull T getPlatformWorld();
|
||||
|
||||
/**
|
||||
* Get the name of the world
|
||||
*
|
||||
* @return World name
|
||||
*/
|
||||
@NotNull String getName();
|
||||
@Nonnull String getName();
|
||||
|
||||
/**
|
||||
* Get a {@link NullWorld} implementation
|
||||
@ -63,11 +63,11 @@ public interface World<T> {
|
||||
private NullWorld() {
|
||||
}
|
||||
|
||||
@NotNull @Override public T getPlatformWorld() {
|
||||
@Nonnull @Override public T getPlatformWorld() {
|
||||
throw new UnsupportedOperationException("Cannot get platform world from NullWorld");
|
||||
}
|
||||
|
||||
@Override public @NotNull String getName() {
|
||||
@Override public @Nonnull String getName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
@ -42,8 +42,8 @@ import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.world.gamemode.GameMode;
|
||||
import com.sk89q.worldedit.world.gamemode.GameModes;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@ -53,9 +53,9 @@ public class ConsolePlayer extends PlotPlayer<Actor> {
|
||||
|
||||
private final Actor actor;
|
||||
|
||||
@Inject private ConsolePlayer(@NotNull final PlotAreaManager plotAreaManager,
|
||||
@NotNull final EventDispatcher eventDispatcher,
|
||||
@ConsoleActor @NotNull final Actor actor,
|
||||
@Inject private ConsolePlayer(@Nonnull final PlotAreaManager plotAreaManager,
|
||||
@Nonnull final EventDispatcher eventDispatcher,
|
||||
@ConsoleActor @Nonnull final Actor actor,
|
||||
@Nullable final EconHandler econHandler) {
|
||||
super(plotAreaManager, eventDispatcher, econHandler);
|
||||
this.actor = actor;
|
||||
@ -73,7 +73,7 @@ public class ConsolePlayer extends PlotPlayer<Actor> {
|
||||
region.getMinimumPoint().getX() + region.getMaximumPoint().getX() / 2, 0,
|
||||
region.getMinimumPoint().getZ() + region.getMaximumPoint().getZ() / 2);
|
||||
} else {
|
||||
location = Location.at("world", 0, 0, 0);
|
||||
location = Location.at("", 0, 0, 0);
|
||||
}
|
||||
setMeta("location", location);
|
||||
}
|
||||
@ -94,7 +94,7 @@ public class ConsolePlayer extends PlotPlayer<Actor> {
|
||||
return this.toActor();
|
||||
}
|
||||
|
||||
@Override public boolean canTeleport(@NotNull Location location) {
|
||||
@Override public boolean canTeleport(@Nonnull Location location) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -102,7 +102,7 @@ public class ConsolePlayer extends PlotPlayer<Actor> {
|
||||
public void sendTitle(String title, String subtitle, int fadeIn, int stay, int fadeOut) {
|
||||
}
|
||||
|
||||
@NotNull @Override public Location getLocation() {
|
||||
@Nonnull @Override public Location getLocation() {
|
||||
return this.getMeta("location");
|
||||
}
|
||||
|
||||
@ -110,7 +110,7 @@ public class ConsolePlayer extends PlotPlayer<Actor> {
|
||||
return getLocation();
|
||||
}
|
||||
|
||||
@NotNull @Override public UUID getUUID() {
|
||||
@Nonnull @Override public UUID getUUID() {
|
||||
return DBFunc.EVERYONE;
|
||||
}
|
||||
|
||||
@ -160,14 +160,14 @@ public class ConsolePlayer extends PlotPlayer<Actor> {
|
||||
return RequiredType.CONSOLE;
|
||||
}
|
||||
|
||||
@Override public void setWeather(@NotNull PlotWeather weather) {
|
||||
@Override public void setWeather(@Nonnull PlotWeather weather) {
|
||||
}
|
||||
|
||||
@Override public @NotNull GameMode getGameMode() {
|
||||
@Override public @Nonnull GameMode getGameMode() {
|
||||
return GameModes.SPECTATOR;
|
||||
}
|
||||
|
||||
@Override public void setGameMode(@NotNull GameMode gameMode) {
|
||||
@Override public void setGameMode(@Nonnull GameMode gameMode) {
|
||||
}
|
||||
|
||||
@Override public void setTime(long time) {
|
||||
@ -180,7 +180,7 @@ public class ConsolePlayer extends PlotPlayer<Actor> {
|
||||
@Override public void setFlight(boolean fly) {
|
||||
}
|
||||
|
||||
@Override public void playMusic(@NotNull Location location, @NotNull ItemType id) {
|
||||
@Override public void playMusic(@Nonnull Location location, @Nonnull ItemType id) {
|
||||
}
|
||||
|
||||
@Override public void kick(String message) {
|
||||
|
@ -54,9 +54,8 @@ import com.plotsquared.core.util.task.TaskManager;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.world.gamemode.GameMode;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
import lombok.NonNull;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Collection;
|
||||
@ -93,13 +92,13 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer
|
||||
private final EventDispatcher eventDispatcher;
|
||||
private final EconHandler econHandler;
|
||||
|
||||
public PlotPlayer(@NotNull final PlotAreaManager plotAreaManager, @NotNull final EventDispatcher eventDispatcher, @Nullable final EconHandler econHandler) {
|
||||
public PlotPlayer(@Nonnull final PlotAreaManager plotAreaManager, @Nonnull final EventDispatcher eventDispatcher, @Nullable final EconHandler econHandler) {
|
||||
this.plotAreaManager = plotAreaManager;
|
||||
this.eventDispatcher = eventDispatcher;
|
||||
this.econHandler = econHandler;
|
||||
}
|
||||
|
||||
public static <T> PlotPlayer<T> from(@NonNull final T object) {
|
||||
public static <T> PlotPlayer<T> from(@Nonnull final T object) {
|
||||
if (!converters.containsKey(object.getClass())) {
|
||||
throw new IllegalArgumentException(String
|
||||
.format("There is no registered PlotPlayer converter for type %s",
|
||||
@ -108,7 +107,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer
|
||||
return converters.get(object.getClass()).convert(object);
|
||||
}
|
||||
|
||||
public static <T> void registerConverter(@NonNull final Class<T> clazz,
|
||||
public static <T> void registerConverter(@Nonnull final Class<T> clazz,
|
||||
final PlotPlayerConverter<T> converter) {
|
||||
converters.put(clazz, converter);
|
||||
}
|
||||
@ -117,7 +116,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer
|
||||
return Collections.unmodifiableCollection(debugModeEnabled);
|
||||
}
|
||||
|
||||
public static Collection<PlotPlayer<?>> getDebugModePlayersInPlot(@NotNull final Plot plot) {
|
||||
public static Collection<PlotPlayer<?>> getDebugModePlayersInPlot(@Nonnull final Plot plot) {
|
||||
if (debugModeEnabled.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@ -376,7 +375,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer
|
||||
*
|
||||
* @return The location
|
||||
*/
|
||||
@NotNull public Location getLocation() {
|
||||
@Nonnull public Location getLocation() {
|
||||
Location location = getMeta("location");
|
||||
if (location != null) {
|
||||
return location;
|
||||
@ -403,9 +402,9 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer
|
||||
*
|
||||
* @return UUID
|
||||
*/
|
||||
@Override @NotNull public abstract UUID getUUID();
|
||||
@Override @Nonnull public abstract UUID getUUID();
|
||||
|
||||
public boolean canTeleport(@NotNull final Location location) {
|
||||
public boolean canTeleport(@Nonnull final Location location) {
|
||||
Preconditions.checkNotNull(location, "Specified location cannot be null");
|
||||
final Location current = getLocationFull();
|
||||
teleport(location);
|
||||
@ -497,21 +496,21 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer
|
||||
*
|
||||
* @param weather the weather visible to the player
|
||||
*/
|
||||
public abstract void setWeather(@NotNull PlotWeather weather);
|
||||
public abstract void setWeather(@Nonnull PlotWeather weather);
|
||||
|
||||
/**
|
||||
* Get this player's gamemode.
|
||||
*
|
||||
* @return the gamemode of the player.
|
||||
*/
|
||||
public abstract @NotNull GameMode getGameMode();
|
||||
public abstract @Nonnull GameMode getGameMode();
|
||||
|
||||
/**
|
||||
* Set this player's gameMode.
|
||||
*
|
||||
* @param gameMode the gamemode to set
|
||||
*/
|
||||
public abstract void setGameMode(@NotNull GameMode gameMode);
|
||||
public abstract void setGameMode(@Nonnull GameMode gameMode);
|
||||
|
||||
/**
|
||||
* Set this player's local time (ticks).
|
||||
@ -540,7 +539,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer
|
||||
* @param location where to play the music
|
||||
* @param id the record item id
|
||||
*/
|
||||
public abstract void playMusic(@NotNull Location location, @NotNull ItemType id);
|
||||
public abstract void playMusic(@Nonnull Location location, @Nonnull ItemType id);
|
||||
|
||||
/**
|
||||
* Check if this player is banned.
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user