diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java index 12a31de02..64d156130 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java @@ -55,7 +55,7 @@ import org.bukkit.plugin.Plugin; import org.bukkit.plugin.java.JavaPlugin; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; import java.io.File; import java.lang.reflect.Method; import java.util.ArrayList; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotAutoMergeEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotAutoMergeEvent.java index 88c9773c9..d30aa5770 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotAutoMergeEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotAutoMergeEvent.java @@ -30,8 +30,8 @@ public final class PlotAutoMergeEvent extends PlotEvent implements Cancellable { * @param plot Plot that was merged * @param plots A list of plots involved in the event */ - public PlotAutoMergeEvent(@Nonnull final World world, @Nonnull final Plot plot, - @Nonnull final List plots) { + public PlotAutoMergeEvent(@NotNull final World world, @NotNull final Plot plot, + @NotNull final List plots) { super(plot); this.world = world; this.plots = plots; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotUnlinkEvent.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotUnlinkEvent.java index 675f10d8f..77566c70c 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotUnlinkEvent.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/events/PlotUnlinkEvent.java @@ -31,8 +31,8 @@ public final class PlotUnlinkEvent extends Event implements Cancellable { * @param world World in which the event occurred * @param plots Plots that are involved in the event */ - public PlotUnlinkEvent(@Nonnull final World world, @Nonnull final PlotArea area, - @Nonnull final List plots) { + public PlotUnlinkEvent(@NotNull final World world, @NotNull final PlotArea area, + @NotNull final List plots) { this.plots = plots; this.world = world; this.area = area; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java index e9a000943..7eae614f7 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/BukkitPlayer.java @@ -184,7 +184,7 @@ public class BukkitPlayer extends PlotPlayer { } } - @Override public void teleport(@Nonnull final Location location) { + @Override public void teleport(@NotNull final Location location) { if (Math.abs(location.getX()) >= 30000000 || Math.abs(location.getZ()) >= 30000000) { return; } @@ -229,7 +229,7 @@ public class BukkitPlayer extends PlotPlayer { } } - @Nonnull @Override public PlotGameMode getGameMode() { + @NotNull @Override public PlotGameMode getGameMode() { switch (this.player.getGameMode()) { case ADVENTURE: return PlotGameMode.ADVENTURE; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitEventUtil.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitEventUtil.java index 744d9084f..c2e39715e 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitEventUtil.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitEventUtil.java @@ -1,22 +1,6 @@ package com.github.intellectualsites.plotsquared.bukkit.util; -import com.github.intellectualsites.plotsquared.bukkit.events.PlayerClaimPlotEvent; -import com.github.intellectualsites.plotsquared.bukkit.events.PlayerEnterPlotEvent; -import com.github.intellectualsites.plotsquared.bukkit.events.PlayerLeavePlotEvent; -import com.github.intellectualsites.plotsquared.bukkit.events.PlayerPlotDeniedEvent; -import com.github.intellectualsites.plotsquared.bukkit.events.PlayerPlotHelperEvent; -import com.github.intellectualsites.plotsquared.bukkit.events.PlayerPlotTrustedEvent; -import com.github.intellectualsites.plotsquared.bukkit.events.PlayerTeleportToPlotEvent; -import com.github.intellectualsites.plotsquared.bukkit.events.PlotAutoMergeEvent; -import com.github.intellectualsites.plotsquared.bukkit.events.PlotChangeOwnerEvent; -import com.github.intellectualsites.plotsquared.bukkit.events.PlotClearEvent; -import com.github.intellectualsites.plotsquared.bukkit.events.PlotComponentSetEvent; -import com.github.intellectualsites.plotsquared.bukkit.events.PlotDeleteEvent; -import com.github.intellectualsites.plotsquared.bukkit.events.PlotFlagAddEvent; -import com.github.intellectualsites.plotsquared.bukkit.events.PlotFlagRemoveEvent; -import com.github.intellectualsites.plotsquared.bukkit.events.PlotMergeEvent; -import com.github.intellectualsites.plotsquared.bukkit.events.PlotRateEvent; -import com.github.intellectualsites.plotsquared.bukkit.events.PlotUnlinkEvent; +import com.github.intellectualsites.plotsquared.bukkit.events.*; import com.github.intellectualsites.plotsquared.bukkit.object.BukkitPlayer; import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.object.Location; @@ -30,9 +14,9 @@ import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; import org.bukkit.event.Event; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.List; import java.util.UUID; @@ -41,91 +25,93 @@ import java.util.UUID; */ public final class BukkitEventUtil extends EventUtil { - @Nullable public Player getPlayer(final PlotPlayer player) { - if (player instanceof BukkitPlayer) { - return ((BukkitPlayer) player).player; + @Nullable public Player getPlayer(final PlotPlayer player) { + if (player instanceof BukkitPlayer) { + return ((BukkitPlayer) player).player; + } + return null; } - return null; - } - private boolean callEvent(@Nonnull final Event event) { - Bukkit.getServer().getPluginManager().callEvent(event); - return !(event instanceof Cancellable) || !((Cancellable) event).isCancelled(); - } - - @Override public boolean callClaim(PlotPlayer player, Plot plot, boolean auto) { - return callEvent(new PlayerClaimPlotEvent(getPlayer(player), plot, auto)); - } - - @Override public boolean callTeleport(PlotPlayer player, Location from, Plot plot) { - return callEvent(new PlayerTeleportToPlotEvent(getPlayer(player), from, plot)); - } - - @Override public boolean callComponentSet(Plot plot, String component) { - return callEvent(new PlotComponentSetEvent(plot, component)); - } - - @Override public boolean callClear(Plot plot) { - return callEvent(new PlotClearEvent(plot)); - } - - @Override public boolean callDelete(Plot plot) { - return callEvent(new PlotDeleteEvent(plot)); - } - - @Override public boolean callFlagAdd(Flag flag, Plot plot) { - return callEvent(new PlotFlagAddEvent(flag, plot)); - } - - @Override public boolean callFlagRemove(Flag flag, Plot plot, Object value) { - return callEvent(new PlotFlagRemoveEvent(flag, plot)); - } - - @Override public boolean callMerge(Plot plot, int dir, int max) { - return callEvent(new PlotMergeEvent(BukkitUtil.getWorld(plot.getWorldName()), plot, dir, max)); - } - - @Override public boolean callAutoMerge(Plot plot, List plots) { - return callEvent(new PlotAutoMergeEvent(BukkitUtil.getWorld(plot.getWorldName()), plot, plots)); - } - - @Override public boolean callUnlink(PlotArea area, List plots) { - return callEvent(new PlotUnlinkEvent(BukkitUtil.getWorld(area.worldname), area, plots)); - } - - @Override public void callEntry(PlotPlayer player, Plot plot) { - callEvent(new PlayerEnterPlotEvent(getPlayer(player), plot)); - } - - @Override public void callLeave(PlotPlayer player, Plot plot) { - callEvent(new PlayerLeavePlotEvent(getPlayer(player), plot)); - } - - @Override public void callDenied(PlotPlayer initiator, Plot plot, UUID player, boolean added) { - callEvent(new PlayerPlotDeniedEvent(getPlayer(initiator), plot, player, added)); - } - - @Override public void callTrusted(PlotPlayer initiator, Plot plot, UUID player, boolean added) { - callEvent(new PlayerPlotTrustedEvent(getPlayer(initiator), plot, player, added)); - } - - @Override public void callMember(PlotPlayer initiator, Plot plot, UUID player, boolean added) { - callEvent(new PlayerPlotHelperEvent(getPlayer(initiator), plot, player, added)); - } - - @Override - public boolean callOwnerChange(PlotPlayer initiator, Plot plot, UUID oldOwner, UUID newOwner, - boolean hasOldOwner) { - return callEvent( - new PlotChangeOwnerEvent(getPlayer(initiator), plot, oldOwner, newOwner, hasOldOwner)); - } - - @Override @Nullable public Rating callRating(PlotPlayer player, Plot plot, Rating rating) { - PlotRateEvent event = new PlotRateEvent(player, rating, plot); - Bukkit.getServer().getPluginManager().callEvent(event); - if (event.isCancelled()) { - return null; + private boolean callEvent(@NotNull final Event event) { + Bukkit.getServer().getPluginManager().callEvent(event); + return !(event instanceof Cancellable) || !((Cancellable) event).isCancelled(); + } + + @Override public boolean callClaim(PlotPlayer player, Plot plot, boolean auto) { + return callEvent(new PlayerClaimPlotEvent(getPlayer(player), plot, auto)); + } + + @Override public boolean callTeleport(PlotPlayer player, Location from, Plot plot) { + return callEvent(new PlayerTeleportToPlotEvent(getPlayer(player), from, plot)); + } + + @Override public boolean callComponentSet(Plot plot, String component) { + return callEvent(new PlotComponentSetEvent(plot, component)); + } + + @Override public boolean callClear(Plot plot) { + return callEvent(new PlotClearEvent(plot)); + } + + @Override public boolean callDelete(Plot plot) { + return callEvent(new PlotDeleteEvent(plot)); + } + + @Override public boolean callFlagAdd(Flag flag, Plot plot) { + return callEvent(new PlotFlagAddEvent(flag, plot)); + } + + @Override public boolean callFlagRemove(Flag flag, Plot plot, Object value) { + return callEvent(new PlotFlagRemoveEvent(flag, plot)); + } + + @Override public boolean callMerge(Plot plot, int dir, int max) { + return callEvent( + new PlotMergeEvent(BukkitUtil.getWorld(plot.getWorldName()), plot, dir, max)); + } + + @Override public boolean callAutoMerge(Plot plot, List plots) { + return callEvent( + new PlotAutoMergeEvent(BukkitUtil.getWorld(plot.getWorldName()), plot, plots)); + } + + @Override public boolean callUnlink(PlotArea area, List plots) { + return callEvent(new PlotUnlinkEvent(BukkitUtil.getWorld(area.worldname), area, plots)); + } + + @Override public void callEntry(PlotPlayer player, Plot plot) { + callEvent(new PlayerEnterPlotEvent(getPlayer(player), plot)); + } + + @Override public void callLeave(PlotPlayer player, Plot plot) { + callEvent(new PlayerLeavePlotEvent(getPlayer(player), plot)); + } + + @Override public void callDenied(PlotPlayer initiator, Plot plot, UUID player, boolean added) { + callEvent(new PlayerPlotDeniedEvent(getPlayer(initiator), plot, player, added)); + } + + @Override public void callTrusted(PlotPlayer initiator, Plot plot, UUID player, boolean added) { + callEvent(new PlayerPlotTrustedEvent(getPlayer(initiator), plot, player, added)); + } + + @Override public void callMember(PlotPlayer initiator, Plot plot, UUID player, boolean added) { + callEvent(new PlayerPlotHelperEvent(getPlayer(initiator), plot, player, added)); + } + + @Override + public boolean callOwnerChange(PlotPlayer initiator, Plot plot, UUID oldOwner, UUID newOwner, + boolean hasOldOwner) { + return callEvent( + new PlotChangeOwnerEvent(getPlayer(initiator), plot, oldOwner, newOwner, hasOldOwner)); + } + + @Override @Nullable public Rating callRating(PlotPlayer player, Plot plot, Rating rating) { + PlotRateEvent event = new PlotRateEvent(player, rating, plot); + Bukkit.getServer().getPluginManager().callEvent(event); + if (event.isCancelled()) { + return null; + } + return event.getRating(); } - return event.getRating(); - } } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitUtil.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitUtil.java index 947dd22fd..9996b99fc 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitUtil.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitUtil.java @@ -29,7 +29,7 @@ import org.bukkit.inventory.Inventory; import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.ItemStack; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java index 2f8fc8235..414e2a0b3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/PlotSquared.java @@ -34,7 +34,7 @@ import lombok.Getter; import lombok.NonNull; import lombok.Setter; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; import java.io.*; import java.net.MalformedURLException; import java.net.URISyntaxException; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Auto.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Auto.java index ff5c02bd0..93eef7813 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Auto.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Auto.java @@ -12,7 +12,7 @@ import com.github.intellectualsites.plotsquared.plot.util.MainUtil; import com.github.intellectualsites.plotsquared.plot.util.Permissions; import com.github.intellectualsites.plotsquared.plot.util.TaskManager; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; import java.util.Set; @CommandDeclaration(command = "auto", permission = "plots.auto", diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Setup.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Setup.java index 2b7e5ab7f..19e94c6f5 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Setup.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/Setup.java @@ -17,7 +17,7 @@ import com.github.intellectualsites.plotsquared.plot.util.StringMan; import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; import lombok.*; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; import java.util.*; import java.util.Map.Entry; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDB.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDB.java index d812413ea..dc9564371 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDB.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDB.java @@ -3,6 +3,7 @@ package com.github.intellectualsites.plotsquared.plot.database; import com.github.intellectualsites.plotsquared.plot.flag.Flag; import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.object.comment.PlotComment; +import org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull; import java.util.*; @@ -301,7 +302,7 @@ public interface AbstractDB { * * @param plot The Plot to get comments from */ - void getComments(@Nonnull Plot plot, String inbox, RunnableVal> whenDone); + void getComments(@NotNull Plot plot, String inbox, RunnableVal> whenDone); void createPlotAndSettings(Plot plot, Runnable whenDone); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/SQLManager.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/SQLManager.java index 49fbc0bc9..16991bf75 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/SQLManager.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/database/SQLManager.java @@ -2170,7 +2170,7 @@ import java.util.concurrent.atomic.AtomicInteger; }); } - @Override public void getComments(@Nonnull Plot plot, final String inbox, + @Override public void getComments(@NotNull Plot plot, final String inbox, final RunnableVal> whenDone) { addPlotTask(plot, new UniqueStatement("getComments_" + plot) { @Override public void set(PreparedStatement statement) throws SQLException { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/ClassicPlotWorld.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/ClassicPlotWorld.java index 6bf38d22c..143879680 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/ClassicPlotWorld.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/generator/ClassicPlotWorld.java @@ -46,7 +46,7 @@ import java.util.Locale; * 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

*/ - @Nonnull @Override public ConfigurationNode[] getSettingNodes() { + @NotNull @Override public ConfigurationNode[] getSettingNodes() { return new ConfigurationNode[] { new ConfigurationNode("plot.height", this.PLOT_HEIGHT, "Plot height", Configuration.INTEGER), diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java index a8fbffad6..253681c89 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/ConsolePlayer.java @@ -7,7 +7,6 @@ import com.github.intellectualsites.plotsquared.plot.util.PlotGameMode; import com.github.intellectualsites.plotsquared.plot.util.PlotWeather; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.util.UUID; public class ConsolePlayer extends PlotPlayer { @@ -101,14 +100,14 @@ public class ConsolePlayer extends PlotPlayer { return RequiredType.CONSOLE; } - @Override public void setWeather(@Nonnull PlotWeather weather) { + @Override public void setWeather(@NotNull PlotWeather weather) { } - @Nonnull @Override public PlotGameMode getGameMode() { + @NotNull @Override public PlotGameMode getGameMode() { return PlotGameMode.NOT_SET; } - @Override public void setGameMode(@Nonnull PlotGameMode gameMode) { + @Override public void setGameMode(@NotNull PlotGameMode gameMode) { } @Override public void setTime(long time) { @@ -121,7 +120,7 @@ public class ConsolePlayer extends PlotPlayer { @Override public void setFlight(boolean fly) { } - @Override public void playMusic(@Nonnull Location location, @Nonnull PlotBlock id) { + @Override public void playMusic(@NotNull Location location, @NotNull PlotBlock id) { } @Override public void kick(String message) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java index 824a812a7..77b60b456 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java @@ -24,7 +24,7 @@ import com.sk89q.jnbt.CompoundTag; import org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; import java.awt.geom.Area; import java.awt.geom.PathIterator; import java.awt.geom.Rectangle2D; @@ -337,7 +337,7 @@ public class Plot { * @param uuid the player uuid * @return if the provided uuid is the owner of the plot */ - public boolean isOwner(@Nonnull UUID uuid) { + public boolean isOwner(@NotNull UUID uuid) { if (uuid.equals(this.getOwner())) { return true; } @@ -993,7 +993,7 @@ public class Plot { * * @param name name */ - public void setSign(@Nonnull String name) { + public void setSign(@NotNull String name) { if (!isLoaded()) { return; } @@ -1524,7 +1524,7 @@ public class Plot { * @param notify notify * @return true if plot was created successfully */ - public boolean create(@Nonnull UUID uuid, final boolean notify) { + public boolean create(@NotNull UUID uuid, final boolean notify) { this.owner = uuid; Plot existing = this.area.getOwnedPlotAbs(this.id); if (existing != null) { @@ -2569,7 +2569,7 @@ public class Plot { * * @return */ - @Nonnull public HashSet getRegions() { + @NotNull public HashSet getRegions() { if (regions_cache != null && connected_cache != null && connected_cache.contains(this)) { return regions_cache; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotArea.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotArea.java index 50ffaf7b3..9c7d88dd2 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotArea.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotArea.java @@ -24,7 +24,7 @@ import com.google.common.collect.ImmutableSet; import org.jetbrains.annotations.NotNull; import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; import java.util.*; import java.util.Map.Entry; import java.util.concurrent.ConcurrentHashMap; @@ -76,7 +76,7 @@ public abstract class PlotArea { private ConcurrentHashMap meta; private QuadMap clusters; - public PlotArea(@Nonnull final String worldName, @Nullable final String id, + public PlotArea(@NotNull final String worldName, @Nullable final String id, @NotNull IndependentPlotGenerator generator, @Nullable final PlotId min, @Nullable final PlotId max) { this.worldname = worldName; @@ -394,7 +394,7 @@ public abstract class PlotArea { } } - @Nonnull @Override public String toString() { + @NotNull @Override public String toString() { if (this.id == null) { return this.worldname; } else { @@ -422,7 +422,7 @@ public abstract class PlotArea { * @param location the location * @return the {@code Plot} or null if none exists */ - @Nullable public Plot getPlotAbs(@Nonnull final Location location) { + @Nullable public Plot getPlotAbs(@NotNull final Location location) { final PlotId pid = this.manager.getPlotId(location.getX(), location.getY(), location.getZ()); if (pid == null) { @@ -437,7 +437,7 @@ public abstract class PlotArea { * @param location the location * @return base Plot */ - @Nullable public Plot getPlot(@Nonnull final Location location) { + @Nullable public Plot getPlot(@NotNull final Location location) { final PlotId pid = this.manager.getPlotId(location.getX(), location.getY(), location.getZ()); if (pid == null) { @@ -452,7 +452,7 @@ public abstract class PlotArea { * @param location the location * @return the base plot or null */ - @Nullable public Plot getOwnedPlot(@Nonnull final Location location) { + @Nullable public Plot getOwnedPlot(@NotNull final Location location) { final PlotId pid = this.manager.getPlotId(location.getX(), location.getY(), location.getZ()); if (pid == null) { @@ -468,7 +468,7 @@ public abstract class PlotArea { * @param location the location * @return Plot or null */ - @Nullable public Plot getOwnedPlotAbs(@Nonnull final Location location) { + @Nullable public Plot getOwnedPlotAbs(@NotNull final Location location) { final PlotId pid = this.manager.getPlotId(location.getX(), location.getY(), location.getZ()); if (pid == null) { @@ -483,11 +483,11 @@ public abstract class PlotArea { * @param id the {@code PlotId} * @return the plot or null */ - @Nullable public Plot getOwnedPlotAbs(@Nonnull final PlotId id) { + @Nullable public Plot getOwnedPlotAbs(@NotNull final PlotId id) { return this.plots.get(id); } - @Nullable public Plot getOwnedPlot(@Nonnull final PlotId id) { + @Nullable public Plot getOwnedPlot(@NotNull final PlotId id) { Plot plot = this.plots.get(id); return plot == null ? null : plot.getBasePlot(false); } @@ -496,17 +496,17 @@ public abstract class PlotArea { return this.TYPE != 2 || getRegionAbs().isIn(x, z); } - public boolean contains(@Nonnull final PlotId id) { + public boolean contains(@NotNull final PlotId id) { return this.min == null || (id.x >= this.min.x && id.x <= this.max.x && id.y >= this.min.y && id.y <= this.max.y); } - public boolean contains(@Nonnull final Location location) { + public boolean contains(@NotNull final Location location) { return StringMan.isEqual(location.getWorld(), this.worldname) && (getRegionAbs() == null || this.region.isIn(location.getX(), location.getZ())); } - @Nonnull Set getPlotsAbs(final UUID uuid) { + @NotNull Set getPlotsAbs(final UUID uuid) { if (uuid == null) { return Collections.emptySet(); } @@ -519,7 +519,7 @@ public abstract class PlotArea { return myPlots; } - @Nonnull public Set getPlots(@Nonnull final UUID uuid) { + @NotNull public Set getPlots(@NotNull final UUID uuid) { return getPlots().stream().filter(plot -> plot.isBasePlot() && plot.isOwner(uuid)) .collect(ImmutableSet.toImmutableSet()); } @@ -533,7 +533,7 @@ public abstract class PlotArea { return this.plots.values(); } - public int getPlotCount(@Nonnull final UUID uuid) { + public int getPlotCount(@NotNull final UUID uuid) { if (!Settings.Done.COUNTS_TOWARDS_LIMIT) { return (int) getPlotsAbs(uuid).stream().filter(plot -> !plot.hasFlag(Flags.DONE)) .count(); @@ -546,11 +546,11 @@ public abstract class PlotArea { * * @deprecated Use {@link #getPlots(UUID)} */ - @Deprecated public Set getPlots(@Nonnull final PlotPlayer player) { + @Deprecated public Set getPlots(@NotNull final PlotPlayer player) { return getPlots(player.getUUID()); } - public boolean hasPlot(@Nonnull final UUID uuid) { + public boolean hasPlot(@NotNull final UUID uuid) { return this.plots.entrySet().stream().anyMatch(entry -> entry.getValue().isOwner(uuid)); } @@ -559,7 +559,7 @@ public abstract class PlotArea { return player != null ? getPlotCount(player.getUUID()) : 0; } - @Nullable public Plot getPlotAbs(@Nonnull final PlotId id) { + @Nullable public Plot getPlotAbs(@NotNull final PlotId id) { Plot plot = getOwnedPlotAbs(id); if (plot == null) { if (this.min != null && (id.x < this.min.x || id.x > this.max.x || id.y < this.min.y @@ -571,7 +571,7 @@ public abstract class PlotArea { return plot; } - @Nullable public Plot getPlot(@Nonnull final PlotId id) { + @Nullable public Plot getPlot(@NotNull final PlotId id) { final Plot plot = getOwnedPlotAbs(id); if (plot == null) { if (this.min != null && (id.x < this.min.x || id.x > this.max.x || id.y < this.min.y @@ -592,7 +592,7 @@ public abstract class PlotArea { return this.plots.size(); } - @Nullable public PlotCluster getCluster(@Nonnull final Location location) { + @Nullable public PlotCluster getCluster(@NotNull final Location location) { final Plot plot = getPlot(location); if (plot == null) { return null; @@ -600,8 +600,8 @@ public abstract class PlotArea { return this.clusters != null ? this.clusters.get(plot.getId().x, plot.getId().y) : null; } - @Nullable public PlotCluster getFirstIntersectingCluster(@Nonnull final PlotId pos1, - @Nonnull final PlotId pos2) { + @Nullable public PlotCluster getFirstIntersectingCluster(@NotNull final PlotId pos1, + @NotNull final PlotId pos2) { if (this.clusters == null) { return null; } @@ -613,7 +613,7 @@ public abstract class PlotArea { return null; } - @Nullable PlotCluster getCluster(@Nonnull final PlotId id) { + @Nullable PlotCluster getCluster(@NotNull final PlotId id) { return this.clusters != null ? this.clusters.get(id.x, id.y) : null; } @@ -628,7 +628,7 @@ public abstract class PlotArea { * * @see FlagManager */ - public void setMeta(@Nonnull final String key, @Nullable final Object value) { + public void setMeta(@NotNull final String key, @Nullable final Object value) { if (this.meta == null) { this.meta = new ConcurrentHashMap<>(); } @@ -645,14 +645,14 @@ public abstract class PlotArea { *
* For persistent metadata use the flag system */ - @Nullable public Object getMeta(@Nonnull final String key) { + @Nullable public Object getMeta(@NotNull final String key) { if (this.meta != null) { return this.meta.get(key); } return null; } - @SuppressWarnings("unused") @Nonnull public Set getBasePlots() { + @SuppressWarnings("unused") @NotNull public Set getBasePlots() { final HashSet myPlots = new HashSet<>(getPlots()); myPlots.removeIf(plot -> !plot.isBasePlot()); return myPlots; @@ -685,15 +685,15 @@ public abstract class PlotArea { * @deprecated Use {@link #getPlotsMap()} */ //todo eventually remove - @Deprecated @Nonnull public Map getPlotsRaw() { + @Deprecated @NotNull public Map getPlotsRaw() { return ImmutableMap.copyOf(plots); } - @Nonnull public Set> getPlotEntries() { + @NotNull public Set> getPlotEntries() { return this.plots.entrySet(); } - public boolean addPlot(@Nonnull final Plot plot) { + public boolean addPlot(@NotNull final Plot plot) { for (PlotPlayer pp : plot.getPlayersInPlot()) { pp.setMeta(PlotPlayer.META_LAST_PLOT, plot); } @@ -731,7 +731,7 @@ public abstract class PlotArea { return null; } - public boolean addPlotIfAbsent(@Nonnull final Plot plot) { + public boolean addPlotIfAbsent(@NotNull final Plot plot) { if (this.plots.putIfAbsent(plot.getId(), plot) == null) { for (PlotPlayer pp : plot.getPlayersInPlot()) { pp.setMeta(PlotPlayer.META_LAST_PLOT, plot); @@ -741,7 +741,7 @@ public abstract class PlotArea { return false; } - public boolean addPlotAbs(@Nonnull final Plot plot) { + public boolean addPlotAbs(@NotNull final Plot plot) { return this.plots.put(plot.getId(), plot) == null; } @@ -786,14 +786,14 @@ public abstract class PlotArea { * * @param key Meta data key */ - public void deleteMeta(@Nonnull final String key) { + public void deleteMeta(@NotNull final String key) { if (this.meta != null) { this.meta.remove(key); } } - public boolean canClaim(@Nullable final PlotPlayer player, @Nonnull final PlotId pos1, - @Nonnull final PlotId pos2) { + public boolean canClaim(@Nullable final PlotPlayer player, @NotNull final PlotId pos1, + @NotNull final PlotId pos2) { if (pos1.x == pos2.x && pos1.y == pos2.y) { if (getOwnedPlot(pos1) != null) { return false; @@ -819,11 +819,11 @@ public abstract class PlotArea { return true; } - public boolean removePlot(@Nonnull final PlotId id) { + public boolean removePlot(@NotNull final PlotId id) { return this.plots.remove(id) != null; } - public boolean mergePlots(@Nonnull final List plotIds, final boolean removeRoads) { + public boolean mergePlots(@NotNull final List plotIds, final boolean removeRoads) { if (plotIds.size() < 2) { return false; } @@ -901,7 +901,7 @@ public abstract class PlotArea { * @param pos2 second corner of selection * @return the plots in the selection which are owned */ - public Set getPlotSelectionOwned(@Nonnull final PlotId pos1, @Nonnull final PlotId pos2) { + public Set getPlotSelectionOwned(@NotNull final PlotId pos1, @NotNull final PlotId pos2) { final int size = (1 + pos2.x - pos1.x) * (1 + pos2.y - pos1.y); final Set result = new HashSet<>(); if (size < 16 || size < getPlotCount()) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotId.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotId.java index 10b9e4c71..6506a1d50 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotId.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotId.java @@ -1,7 +1,7 @@ package com.github.intellectualsites.plotsquared.plot.object; import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; public class PlotId { /** @@ -32,14 +32,14 @@ public class PlotId { * @return the PlotId representation of the arguement * @throws IllegalArgumentException if the string does not contain a valid PlotId */ - @Nonnull public static PlotId fromString(@Nonnull String string) { + @NotNull public static PlotId fromString(@NotNull String string) { PlotId plot = fromStringOrNull(string); if (plot == null) throw new IllegalArgumentException("Cannot create PlotID. String invalid."); return plot; } - @Nullable public static PlotId fromStringOrNull(@Nonnull String string) { + @Nullable public static PlotId fromStringOrNull(@NotNull String string) { String[] parts = string.split("[;|,]"); if (parts.length < 2) { return null; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotPlayer.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotPlayer.java index 4da8cae90..04390adbe 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotPlayer.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/PlotPlayer.java @@ -422,21 +422,21 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { * * @param weather the weather visible to the player */ - public abstract void setWeather(@Nonnull PlotWeather weather); + public abstract void setWeather(@NotNull PlotWeather weather); /** * Get this player's gamemode. * * @return the gamemode of the player. */ - @Nonnull public abstract PlotGameMode getGameMode(); + @NotNull public abstract PlotGameMode getGameMode(); /** * Set this player's gameMode. * * @param gameMode the gamemode to set */ - public abstract void setGameMode(@Nonnull PlotGameMode gameMode); + public abstract void setGameMode(@NotNull PlotGameMode gameMode); /** * Set this player's local time (ticks). @@ -465,7 +465,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer { * @param location where to play the music * @param id the record item id */ - public abstract void playMusic(@Nonnull Location location, @Nonnull PlotBlock id); + public abstract void playMusic(@NotNull Location location, @NotNull PlotBlock id); /** * Check if this player is banned. diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlot.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlot.java index 36d23c8f6..c216b4589 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlot.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlot.java @@ -60,7 +60,7 @@ public class SinglePlot extends Plot { return super.isLoaded(); } - @Nonnull @Override public HashSet getRegions() { + @NotNull @Override public HashSet getRegions() { return regions; } diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotArea.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotArea.java index 41801c087..28a2e02dc 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotArea.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/worlds/SinglePlotArea.java @@ -11,7 +11,7 @@ import com.github.intellectualsites.plotsquared.plot.util.TaskManager; import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; import java.io.File; import java.io.IOException; import java.nio.file.Files; @@ -113,38 +113,38 @@ public class SinglePlotArea extends GridPlotWorld { new ConfigurationNode("void", this.VOID, "Void world", Configuration.BOOLEAN)}; } - @Nullable @Override public Plot getOwnedPlot(@Nonnull final Location location) { + @Nullable @Override public Plot getOwnedPlot(@NotNull final Location location) { PlotId pid = PlotId.fromStringOrNull(location.getWorld()); Plot plot = pid == null ? null : this.plots.get(pid); return plot == null ? null : plot.getBasePlot(false); } - @Nullable @Override public Plot getOwnedPlotAbs(@Nonnull Location location) { + @Nullable @Override public Plot getOwnedPlotAbs(@NotNull Location location) { PlotId pid = PlotId.fromStringOrNull(location.getWorld()); return pid == null ? null : plots.get(pid); } - @Nullable @Override public Plot getPlot(@Nonnull final Location location) { + @Nullable @Override public Plot getPlot(@NotNull final Location location) { PlotId pid = PlotId.fromStringOrNull(location.getWorld()); return pid == null ? null : getPlot(pid); } - @Nullable @Override public Plot getPlotAbs(@Nonnull final Location location) { + @Nullable @Override public Plot getPlotAbs(@NotNull final Location location) { final PlotId pid = PlotId.fromStringOrNull(location.getWorld()); return pid == null ? null : getPlotAbs(pid); } - public boolean addPlot(@Nonnull Plot plot) { + public boolean addPlot(@NotNull Plot plot) { plot = adapt(plot); return super.addPlot(plot); } - @Override public boolean addPlotAbs(@Nonnull Plot plot) { + @Override public boolean addPlotAbs(@NotNull Plot plot) { plot = adapt(plot); return super.addPlotAbs(plot); } - @Override public boolean addPlotIfAbsent(@Nonnull Plot plot) { + @Override public boolean addPlotIfAbsent(@NotNull Plot plot) { plot = adapt(plot); return super.addPlotIfAbsent(plot); } @@ -160,7 +160,7 @@ public class SinglePlotArea extends GridPlotWorld { return p; } - @Nullable public Plot getPlotAbs(@Nonnull final PlotId id) { + @Nullable public Plot getPlotAbs(@NotNull final PlotId id) { Plot plot = getOwnedPlotAbs(id); if (plot == null) { return new SinglePlot(this, id); @@ -168,7 +168,7 @@ public class SinglePlotArea extends GridPlotWorld { return plot; } - @Nullable public Plot getPlot(@Nonnull PlotId id) { + @Nullable public Plot getPlot(@NotNull PlotId id) { // TODO Plot plot = getOwnedPlotAbs(id); if (plot == null) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EventUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EventUtil.java index 0a5b77515..b2b88d342 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EventUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/EventUtil.java @@ -10,7 +10,7 @@ import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotArea; import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; import java.util.HashSet; import java.util.List; import java.util.Optional; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MainUtil.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MainUtil.java index e45d70caf..10e81c8db 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MainUtil.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/MainUtil.java @@ -329,7 +329,7 @@ public class MainUtil { * @param owner * @return The player's name, None, Everyone or Unknown */ - @Nonnull public static String getName(UUID owner) { + @NotNull public static String getName(UUID owner) { if (owner == null) { return Captions.NONE.getTranslated(); } @@ -358,7 +358,7 @@ public class MainUtil { * @return * @see Plot#getCorners() */ - @Nonnull public static Location[] getCorners(String world, Collection regions) { + @NotNull public static Location[] getCorners(String world, Collection regions) { Location min = null; Location max = null; for (RegionWrapper region : regions) { diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandler.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandler.java index 315687463..60a0d778b 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandler.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandler.java @@ -11,7 +11,7 @@ import com.github.intellectualsites.plotsquared.plot.uuid.UUIDWrapper; import com.google.common.collect.BiMap; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; import java.util.HashMap; import java.util.HashSet; import java.util.Map; diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandlerImplementation.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandlerImplementation.java index 55ff35c95..17ab6b5ce 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandlerImplementation.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/util/UUIDHandlerImplementation.java @@ -15,7 +15,7 @@ import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nullable; +import org.jetbrains.annotations.Nullable; import java.util.HashMap; import java.util.HashSet; import java.util.Map; diff --git a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDBTest.java b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDBTest.java index 1ef5c92ec..944aa6cab 100644 --- a/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDBTest.java +++ b/Core/src/test/java/com/github/intellectualsites/plotsquared/plot/database/AbstractDBTest.java @@ -149,7 +149,7 @@ public class AbstractDBTest implements AbstractDB { @Override public void setComment(Plot plot, PlotComment comment) { } - @Override public void getComments(@Nonnull Plot plot, String inbox, + @Override public void getComments(@NotNull Plot plot, String inbox, RunnableVal> whenDone) { }