mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Remove jetbrains annotations
This commit is contained in:
parent
85a23442cc
commit
41f494fbff
@ -12,7 +12,6 @@ dependencies {
|
|||||||
force = true
|
force = true
|
||||||
}
|
}
|
||||||
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.3.72")
|
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.3.72")
|
||||||
implementation("org.jetbrains:annotations:20.0.0")
|
|
||||||
implementation("org.khelekore:prtree:1.7.0-SNAPSHOT")
|
implementation("org.khelekore:prtree:1.7.0-SNAPSHOT")
|
||||||
// Adventure related stuff
|
// Adventure related stuff
|
||||||
implementation('net.kyori:adventure-api:4.0.0-SNAPSHOT')
|
implementation('net.kyori:adventure-api:4.0.0-SNAPSHOT')
|
||||||
|
@ -92,12 +92,6 @@
|
|||||||
<version>1.3.72</version>
|
<version>1.3.72</version>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.jetbrains</groupId>
|
|
||||||
<artifactId>annotations</artifactId>
|
|
||||||
<version>20.0.0</version>
|
|
||||||
<scope>runtime</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.khelekore</groupId>
|
<groupId>org.khelekore</groupId>
|
||||||
<artifactId>prtree</artifactId>
|
<artifactId>prtree</artifactId>
|
||||||
|
@ -46,7 +46,6 @@ import com.sk89q.worldedit.world.biome.BiomeType;
|
|||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
@ -268,7 +267,7 @@ public class HybridPlotManager extends ClassicPlotManager {
|
|||||||
* @param plot The plot
|
* @param plot The plot
|
||||||
* @return The location where a sign should be
|
* @return The location where a sign should be
|
||||||
*/
|
*/
|
||||||
@Override public Location getSignLoc(@Nonnull final @NotNull Plot plot) {
|
@Override public Location getSignLoc(@Nonnull final Plot plot) {
|
||||||
return hybridPlotWorld.getSignLocation(plot);
|
return hybridPlotWorld.getSignLocation(plot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,6 @@ import com.plotsquared.core.queue.QueueCoordinator;
|
|||||||
import com.plotsquared.core.util.HashUtil;
|
import com.plotsquared.core.util.HashUtil;
|
||||||
import com.plotsquared.core.util.RegionManager;
|
import com.plotsquared.core.util.RegionManager;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -59,7 +58,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
|
|||||||
this.regionManager = regionManager;
|
this.regionManager = regionManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean clearPlot(final @NotNull Plot plot, final @Nullable Runnable whenDone, @Nullable QueueCoordinator queue) {
|
@Override public boolean clearPlot(final @Nonnull Plot plot, final @Nullable Runnable whenDone, @Nullable QueueCoordinator queue) {
|
||||||
final Set<CuboidRegion> regions = plot.getRegions();
|
final Set<CuboidRegion> regions = plot.getRegions();
|
||||||
Runnable run = new Runnable() {
|
Runnable run = new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
@ -81,7 +80,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public Location getPlotTopLocAbs(@NotNull PlotId plotId) {
|
@Override public Location getPlotTopLocAbs(@Nonnull PlotId plotId) {
|
||||||
int px = plotId.getX();
|
int px = plotId.getX();
|
||||||
int pz = plotId.getY();
|
int pz = plotId.getY();
|
||||||
int x = (squarePlotWorld.ROAD_OFFSET_X + (px * (squarePlotWorld.ROAD_WIDTH + squarePlotWorld.PLOT_WIDTH))) - (int) Math
|
int x = (squarePlotWorld.ROAD_OFFSET_X + (px * (squarePlotWorld.ROAD_WIDTH + squarePlotWorld.PLOT_WIDTH))) - (int) Math
|
||||||
@ -242,7 +241,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
|
|||||||
/**
|
/**
|
||||||
* Get the bottom plot loc (some basic math).
|
* Get the bottom plot loc (some basic math).
|
||||||
*/
|
*/
|
||||||
@Override public Location getPlotBottomLocAbs(@NotNull PlotId plotId) {
|
@Override public Location getPlotBottomLocAbs(@Nonnull PlotId plotId) {
|
||||||
int px = plotId.getX();
|
int px = plotId.getX();
|
||||||
int pz = plotId.getY();
|
int pz = plotId.getY();
|
||||||
int x = (squarePlotWorld.ROAD_OFFSET_X + (px * (squarePlotWorld.ROAD_WIDTH + squarePlotWorld.PLOT_WIDTH))) - squarePlotWorld.PLOT_WIDTH
|
int x = (squarePlotWorld.ROAD_OFFSET_X + (px * (squarePlotWorld.ROAD_WIDTH + squarePlotWorld.PLOT_WIDTH))) - squarePlotWorld.PLOT_WIDTH
|
||||||
|
@ -28,12 +28,11 @@ package com.plotsquared.core.inject.factory;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.assistedinject.Assisted;
|
import com.google.inject.assistedinject.Assisted;
|
||||||
import com.plotsquared.core.queue.ChunkCoordinatorBuilder;
|
import com.plotsquared.core.queue.ChunkCoordinatorBuilder;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public interface ChunkCoordinatorBuilderFactory {
|
public interface ChunkCoordinatorBuilderFactory {
|
||||||
|
|
||||||
@Inject @Nonnull ChunkCoordinatorBuilder create(@Assisted @NotNull ChunkCoordinatorFactory chunkCoordinatorFactory);
|
@Inject @Nonnull ChunkCoordinatorBuilder create(@Assisted @Nonnull ChunkCoordinatorFactory chunkCoordinatorFactory);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,6 @@ import net.kyori.adventure.text.Component;
|
|||||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||||
import net.kyori.adventure.text.minimessage.Template;
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
import net.kyori.adventure.title.Title;
|
import net.kyori.adventure.title.Title;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -851,7 +850,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Redefine from PermissionHolder as it's required from CommandCaller
|
// Redefine from PermissionHolder as it's required from CommandCaller
|
||||||
@Override public boolean hasPermission(@NotNull String permission) {
|
@Override public boolean hasPermission(@Nonnull String permission) {
|
||||||
return hasPermission(null, permission);
|
return hasPermission(null, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,6 @@ import com.sk89q.worldedit.function.pattern.BlockPattern;
|
|||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -57,21 +56,21 @@ public final class BlockBucket implements ConfigurationSerializable {
|
|||||||
private BlockState single;
|
private BlockState single;
|
||||||
private Pattern pattern;
|
private Pattern pattern;
|
||||||
|
|
||||||
public BlockBucket(@NotNull final BlockType type) {
|
public BlockBucket(@Nonnull final BlockType type) {
|
||||||
this(type.getId());
|
this(type.getId());
|
||||||
this.single = type.getDefaultState();
|
this.single = type.getDefaultState();
|
||||||
this.pattern = new BlockPattern(this.single);
|
this.pattern = new BlockPattern(this.single);
|
||||||
this.compiled = true;
|
this.compiled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockBucket(@NotNull final BlockState state) {
|
public BlockBucket(@Nonnull final BlockState state) {
|
||||||
this(state.getAsString());
|
this(state.getAsString());
|
||||||
this.single = state;
|
this.single = state;
|
||||||
this.pattern = new BlockPattern(this.single);
|
this.pattern = new BlockPattern(this.single);
|
||||||
this.compiled = true;
|
this.compiled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockBucket(@NotNull final String input) {
|
public BlockBucket(@Nonnull final String input) {
|
||||||
this.input = new StringBuilder(input);
|
this.input = new StringBuilder(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,6 @@ import com.plotsquared.core.queue.QueueCoordinator;
|
|||||||
import com.plotsquared.core.util.FileUtils;
|
import com.plotsquared.core.util.FileUtils;
|
||||||
import com.plotsquared.core.util.task.TaskManager;
|
import com.plotsquared.core.util.task.TaskManager;
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
@ -56,15 +55,15 @@ public class SinglePlotManager extends PlotManager {
|
|||||||
return PlotId.of(0, 0);
|
return PlotId.of(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public Location getPlotBottomLocAbs(@Nonnull final @NotNull PlotId plotId) {
|
@Override public Location getPlotBottomLocAbs(@Nonnull final PlotId plotId) {
|
||||||
return Location.at(plotId.toCommaSeparatedString(), -30000000, 0, -30000000);
|
return Location.at(plotId.toCommaSeparatedString(), -30000000, 0, -30000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public Location getPlotTopLocAbs(@Nonnull final @NotNull PlotId plotId) {
|
@Override public Location getPlotTopLocAbs(@Nonnull final PlotId plotId) {
|
||||||
return Location.at(plotId.toCommaSeparatedString(), 30000000, 0, 30000000);
|
return Location.at(plotId.toCommaSeparatedString(), 30000000, 0, 30000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean clearPlot(@NotNull Plot plot, final Runnable whenDone, @Nullable QueueCoordinator queue) {
|
@Override public boolean clearPlot(@Nonnull Plot plot, final Runnable whenDone, @Nullable QueueCoordinator queue) {
|
||||||
PlotSquared.platform().getSetupUtils().unload(plot.getWorldName(), false);
|
PlotSquared.platform().getSetupUtils().unload(plot.getWorldName(), false);
|
||||||
final File worldFolder = new File(PlotSquared.platform().getWorldContainer(), plot.getWorldName());
|
final File worldFolder = new File(PlotSquared.platform().getWorldContainer(), plot.getWorldName());
|
||||||
TaskManager.getPlatformImplementation().taskAsync(() -> {
|
TaskManager.getPlatformImplementation().taskAsync(() -> {
|
||||||
@ -76,68 +75,68 @@ public class SinglePlotManager extends PlotManager {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean claimPlot(@NotNull Plot plot, @Nullable QueueCoordinator queue) {
|
@Override public boolean claimPlot(@Nonnull Plot plot, @Nullable QueueCoordinator queue) {
|
||||||
// TODO
|
// TODO
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean unClaimPlot(@NotNull Plot plot, Runnable whenDone, @Nullable QueueCoordinator queue) {
|
@Override public boolean unClaimPlot(@Nonnull Plot plot, Runnable whenDone, @Nullable QueueCoordinator queue) {
|
||||||
if (whenDone != null) {
|
if (whenDone != null) {
|
||||||
whenDone.run();
|
whenDone.run();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public Location getSignLoc(@NotNull Plot plot) {
|
@Override public Location getSignLoc(@Nonnull Plot plot) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public String[] getPlotComponents(@NotNull PlotId plotId) {
|
@Override public String[] getPlotComponents(@Nonnull PlotId plotId) {
|
||||||
return new String[0];
|
return new String[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setComponent(@NotNull PlotId plotId, @NotNull String component, @NotNull Pattern blocks, @Nullable QueueCoordinator queue) {
|
public boolean setComponent(@Nonnull PlotId plotId, @Nonnull String component, @Nonnull Pattern blocks, @Nullable QueueCoordinator queue) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean createRoadEast(@NotNull Plot plot, @Nullable QueueCoordinator queue) {
|
@Override public boolean createRoadEast(@Nonnull Plot plot, @Nullable QueueCoordinator queue) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean createRoadSouth(@NotNull Plot plot, @Nullable QueueCoordinator queue) {
|
@Override public boolean createRoadSouth(@Nonnull Plot plot, @Nullable QueueCoordinator queue) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean createRoadSouthEast(@NotNull Plot plot, @Nullable QueueCoordinator queue) {
|
@Override public boolean createRoadSouthEast(@Nonnull Plot plot, @Nullable QueueCoordinator queue) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean removeRoadEast(@NotNull Plot plot, @Nullable QueueCoordinator queue) {
|
@Override public boolean removeRoadEast(@Nonnull Plot plot, @Nullable QueueCoordinator queue) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean removeRoadSouth(@NotNull Plot plot, @Nullable QueueCoordinator queue) {
|
@Override public boolean removeRoadSouth(@Nonnull Plot plot, @Nullable QueueCoordinator queue) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean removeRoadSouthEast(@NotNull Plot plot, @Nullable QueueCoordinator queue) {
|
@Override public boolean removeRoadSouthEast(@Nonnull Plot plot, @Nullable QueueCoordinator queue) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean startPlotMerge(@NotNull List<PlotId> plotIds, @Nullable QueueCoordinator queue) {
|
@Override public boolean startPlotMerge(@Nonnull List<PlotId> plotIds, @Nullable QueueCoordinator queue) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean startPlotUnlink(@NotNull List<PlotId> plotIds, @Nullable QueueCoordinator queue) {
|
@Override public boolean startPlotUnlink(@Nonnull List<PlotId> plotIds, @Nullable QueueCoordinator queue) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean finishPlotMerge(@NotNull List<PlotId> plotIds, @Nullable QueueCoordinator queue) {
|
@Override public boolean finishPlotMerge(@Nonnull List<PlotId> plotIds, @Nullable QueueCoordinator queue) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean finishPlotUnlink(@NotNull List<PlotId> plotIds, @Nullable QueueCoordinator queue) {
|
@Override public boolean finishPlotUnlink(@Nonnull List<PlotId> plotIds, @Nullable QueueCoordinator queue) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,8 @@ package com.plotsquared.core.util.placeholders;
|
|||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A placeholder is a keyed value that gets replaced by a {@link PlotPlayer player}-specific value at runtime
|
* A placeholder is a keyed value that gets replaced by a {@link PlotPlayer player}-specific value at runtime
|
||||||
@ -36,7 +37,7 @@ public abstract class Placeholder {
|
|||||||
|
|
||||||
private final String key;
|
private final String key;
|
||||||
|
|
||||||
public Placeholder(@NotNull final String key) {
|
public Placeholder(@Nonnull final String key) {
|
||||||
this.key = Preconditions.checkNotNull(key, "Key may not be null");
|
this.key = Preconditions.checkNotNull(key, "Key may not be null");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,14 +47,14 @@ public abstract class Placeholder {
|
|||||||
* @param player Player
|
* @param player Player
|
||||||
* @return Placeholder value. Return {@code ""} if no placeholder value can be returned
|
* @return Placeholder value. Return {@code ""} if no placeholder value can be returned
|
||||||
*/
|
*/
|
||||||
@NotNull public abstract String getValue(@NotNull final PlotPlayer<?> player);
|
@Nonnull public abstract String getValue(@Nonnull final PlotPlayer<?> player);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the placeholder key
|
* Get the placeholder key
|
||||||
*
|
*
|
||||||
* @return Placeholder key
|
* @return Placeholder key
|
||||||
*/
|
*/
|
||||||
@NotNull public final String getKey() {
|
@Nonnull public final String getKey() {
|
||||||
return this.key;
|
return this.key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,9 +34,9 @@ import com.plotsquared.core.plot.flag.GlobalFlagContainer;
|
|||||||
import com.plotsquared.core.plot.flag.PlotFlag;
|
import com.plotsquared.core.plot.flag.PlotFlag;
|
||||||
import com.plotsquared.core.util.EventDispatcher;
|
import com.plotsquared.core.util.EventDispatcher;
|
||||||
import com.plotsquared.core.util.PlayerManager;
|
import com.plotsquared.core.util.PlayerManager;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@ -52,7 +52,7 @@ public final class PlaceholderRegistry {
|
|||||||
private final Map<String, Placeholder> placeholders;
|
private final Map<String, Placeholder> placeholders;
|
||||||
private final EventDispatcher eventDispatcher;
|
private final EventDispatcher eventDispatcher;
|
||||||
|
|
||||||
public PlaceholderRegistry(@NotNull final EventDispatcher eventDispatcher) {
|
public PlaceholderRegistry(@Nonnull final EventDispatcher eventDispatcher) {
|
||||||
this.placeholders = Maps.newHashMap();
|
this.placeholders = Maps.newHashMap();
|
||||||
this.eventDispatcher = eventDispatcher;
|
this.eventDispatcher = eventDispatcher;
|
||||||
this.registerDefault();
|
this.registerDefault();
|
||||||
@ -124,10 +124,10 @@ public final class PlaceholderRegistry {
|
|||||||
* @param key Placeholder key
|
* @param key Placeholder key
|
||||||
* @param placeholderFunction Placeholder generator. Cannot return null
|
* @param placeholderFunction Placeholder generator. Cannot return null
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("ALL") public void createPlaceholder(@NotNull final String key,
|
@SuppressWarnings("ALL") public void createPlaceholder(@Nonnull final String key,
|
||||||
@NotNull final Function<PlotPlayer<?>, String> placeholderFunction) {
|
@Nonnull final Function<PlotPlayer<?>, String> placeholderFunction) {
|
||||||
this.registerPlaceholder(new Placeholder(key) {
|
this.registerPlaceholder(new Placeholder(key) {
|
||||||
@Override @NotNull public String getValue(@NotNull final PlotPlayer<?> player) {
|
@Override @Nonnull public String getValue(@Nonnull final PlotPlayer<?> player) {
|
||||||
return placeholderFunction.apply(player);
|
return placeholderFunction.apply(player);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -139,10 +139,10 @@ public final class PlaceholderRegistry {
|
|||||||
* @param key Placeholder key
|
* @param key Placeholder key
|
||||||
* @param placeholderFunction Placeholder generator. Cannot return null
|
* @param placeholderFunction Placeholder generator. Cannot return null
|
||||||
*/
|
*/
|
||||||
public void createPlaceholder(@NotNull final String key,
|
public void createPlaceholder(@Nonnull final String key,
|
||||||
@NotNull final BiFunction<PlotPlayer<?>, Plot, String> placeholderFunction) {
|
@Nonnull final BiFunction<PlotPlayer<?>, Plot, String> placeholderFunction) {
|
||||||
this.registerPlaceholder(new PlotSpecificPlaceholder(key) {
|
this.registerPlaceholder(new PlotSpecificPlaceholder(key) {
|
||||||
@Override @NotNull public String getValue(@NotNull final PlotPlayer<?> player, @NotNull final Plot plot) {
|
@Override @Nonnull public String getValue(@Nonnull final PlotPlayer<?> player, @Nonnull final Plot plot) {
|
||||||
return placeholderFunction.apply(player, plot);
|
return placeholderFunction.apply(player, plot);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -153,7 +153,7 @@ public final class PlaceholderRegistry {
|
|||||||
*
|
*
|
||||||
* @param placeholder Placeholder instance
|
* @param placeholder Placeholder instance
|
||||||
*/
|
*/
|
||||||
public void registerPlaceholder(@NotNull final Placeholder placeholder) {
|
public void registerPlaceholder(@Nonnull final Placeholder placeholder) {
|
||||||
final Placeholder previous = this.placeholders
|
final Placeholder previous = this.placeholders
|
||||||
.put(placeholder.getKey().toLowerCase(Locale.ENGLISH),
|
.put(placeholder.getKey().toLowerCase(Locale.ENGLISH),
|
||||||
Preconditions.checkNotNull(placeholder, "Placeholder may not be null"));
|
Preconditions.checkNotNull(placeholder, "Placeholder may not be null"));
|
||||||
@ -168,7 +168,7 @@ public final class PlaceholderRegistry {
|
|||||||
* @param key Placeholder key
|
* @param key Placeholder key
|
||||||
* @return Placeholder value
|
* @return Placeholder value
|
||||||
*/
|
*/
|
||||||
@Nullable public Placeholder getPlaceholder(@NotNull final String key) {
|
@Nullable public Placeholder getPlaceholder(@Nonnull final String key) {
|
||||||
return this.placeholders.get(
|
return this.placeholders.get(
|
||||||
Preconditions.checkNotNull(key, "Key may not be null").toLowerCase(Locale.ENGLISH));
|
Preconditions.checkNotNull(key, "Key may not be null").toLowerCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
@ -181,8 +181,8 @@ public final class PlaceholderRegistry {
|
|||||||
* @param player Player to evaluate for
|
* @param player Player to evaluate for
|
||||||
* @return Replacement value
|
* @return Replacement value
|
||||||
*/
|
*/
|
||||||
@NotNull public String getPlaceholderValue(@NotNull final String key,
|
@Nonnull public String getPlaceholderValue(@Nonnull final String key,
|
||||||
@NotNull final PlotPlayer<?> player) {
|
@Nonnull final PlotPlayer<?> player) {
|
||||||
final Placeholder placeholder = getPlaceholder(key);
|
final Placeholder placeholder = getPlaceholder(key);
|
||||||
if (placeholder == null) {
|
if (placeholder == null) {
|
||||||
return "";
|
return "";
|
||||||
@ -209,7 +209,7 @@ public final class PlaceholderRegistry {
|
|||||||
*
|
*
|
||||||
* @return Unmodifiable collection of placeholders
|
* @return Unmodifiable collection of placeholders
|
||||||
*/
|
*/
|
||||||
@NotNull public Collection<Placeholder> getPlaceholders() {
|
@Nonnull public Collection<Placeholder> getPlaceholders() {
|
||||||
return Collections.unmodifiableCollection(this.placeholders.values());
|
return Collections.unmodifiableCollection(this.placeholders.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,20 +29,21 @@ import com.plotsquared.core.player.PlotPlayer;
|
|||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
import com.plotsquared.core.plot.flag.GlobalFlagContainer;
|
import com.plotsquared.core.plot.flag.GlobalFlagContainer;
|
||||||
import com.plotsquared.core.plot.flag.PlotFlag;
|
import com.plotsquared.core.plot.flag.PlotFlag;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public final class PlotFlagPlaceholder extends PlotSpecificPlaceholder {
|
public final class PlotFlagPlaceholder extends PlotSpecificPlaceholder {
|
||||||
|
|
||||||
private final PlotFlag<?, ?> flag;
|
private final PlotFlag<?, ?> flag;
|
||||||
private final boolean local;
|
private final boolean local;
|
||||||
|
|
||||||
public PlotFlagPlaceholder(@NotNull final PlotFlag<?, ?> flag, final boolean local) {
|
public PlotFlagPlaceholder(@Nonnull final PlotFlag<?, ?> flag, final boolean local) {
|
||||||
super(String.format("currentplot_%sflag_%s", local ? "local": "", flag.getName()));
|
super(String.format("currentplot_%sflag_%s", local ? "local": "", flag.getName()));
|
||||||
this.flag = flag;
|
this.flag = flag;
|
||||||
this.local = local;
|
this.local = local;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override @NotNull public String getValue(@NotNull final PlotPlayer<?> player, @NotNull final Plot plot) {
|
@Override @Nonnull public String getValue(@Nonnull final PlotPlayer<?> player, @Nonnull final Plot plot) {
|
||||||
return this.getFlagValue(plot, this.flag.getName(), !this.local);
|
return this.getFlagValue(plot, this.flag.getName(), !this.local);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +58,7 @@ public final class PlotFlagPlaceholder extends PlotSpecificPlaceholder {
|
|||||||
* @param inherit Define if it returns only the flag set on the current plot or also inherited flags
|
* @param inherit Define if it returns only the flag set on the current plot or also inherited flags
|
||||||
* @return The value of flag serialized in string
|
* @return The value of flag serialized in string
|
||||||
*/
|
*/
|
||||||
@NotNull private String getFlagValue(@NotNull final Plot plot, @NotNull final String flagName, final boolean inherit) {
|
@Nonnull private String getFlagValue(@Nonnull final Plot plot, @Nonnull final String flagName, final boolean inherit) {
|
||||||
if (flagName.isEmpty()) {
|
if (flagName.isEmpty()) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -27,18 +27,19 @@ package com.plotsquared.core.util.placeholders;
|
|||||||
|
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link Placeholder placeholder} that requires a {@link com.plotsquared.core.plot.Plot plot}
|
* A {@link Placeholder placeholder} that requires a {@link com.plotsquared.core.plot.Plot plot}
|
||||||
*/
|
*/
|
||||||
public abstract class PlotSpecificPlaceholder extends Placeholder {
|
public abstract class PlotSpecificPlaceholder extends Placeholder {
|
||||||
|
|
||||||
public PlotSpecificPlaceholder(@NotNull final String key) {
|
public PlotSpecificPlaceholder(@Nonnull final String key) {
|
||||||
super(key);
|
super(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override @NotNull public final String getValue(@NotNull final PlotPlayer<?> player) {
|
@Override @Nonnull public final String getValue(@Nonnull final PlotPlayer<?> player) {
|
||||||
final Plot plot = player.getCurrentPlot();
|
final Plot plot = player.getCurrentPlot();
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return "";
|
return "";
|
||||||
@ -53,7 +54,7 @@ public abstract class PlotSpecificPlaceholder extends Placeholder {
|
|||||||
* @param plot Plot that the player is in
|
* @param plot Plot that the player is in
|
||||||
* @return Placeholder value, or {@code ""} if the placeholder does not apply
|
* @return Placeholder value, or {@code ""} if the placeholder does not apply
|
||||||
*/
|
*/
|
||||||
@NotNull public abstract String getValue(@NotNull final PlotPlayer<?> player,
|
@Nonnull public abstract String getValue(@Nonnull final PlotPlayer<?> player,
|
||||||
@NotNull final Plot plot);
|
@Nonnull final Plot plot);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,6 @@ buildscript {
|
|||||||
configurations.all {
|
configurations.all {
|
||||||
resolutionStrategy {
|
resolutionStrategy {
|
||||||
force("org.ow2.asm:asm:8.0.1")
|
force("org.ow2.asm:asm:8.0.1")
|
||||||
force("org.jetbrains:annotations:20.1.0")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -96,7 +95,6 @@ subprojects { subproject ->
|
|||||||
resolutionStrategy {
|
resolutionStrategy {
|
||||||
force("junit:junit:4.12")
|
force("junit:junit:4.12")
|
||||||
force("com.google.guava:guava:21.0")
|
force("com.google.guava:guava:21.0")
|
||||||
force("org.jetbrains:annotations:20.1.0")
|
|
||||||
force("com.google.code.findbugs:jsr305:3.0.2")
|
force("com.google.code.findbugs:jsr305:3.0.2")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user