Change @Nullable/@NotNull annotation placement

This commit is contained in:
filoghost 2021-05-02 20:29:57 +02:00
parent ee76d568dc
commit 1f6adc8679
14 changed files with 30 additions and 56 deletions

View File

@ -30,8 +30,7 @@ public interface Hologram {
* @return the new TextLine appended
* @since 1
*/
@NotNull
TextLine appendTextLine(@Nullable String text);
@NotNull TextLine appendTextLine(@Nullable String text);
/**
@ -41,8 +40,7 @@ public interface Hologram {
* @return the new ItemLine appended
* @since 1
*/
@NotNull
ItemLine appendItemLine(@NotNull ItemStack itemStack);
@NotNull ItemLine appendItemLine(@NotNull ItemStack itemStack);
/**
@ -55,8 +53,7 @@ public interface Hologram {
* @throws IndexOutOfBoundsException if the index is out of range (index < 0 || index >= size())
* @since 1
*/
@NotNull
TextLine insertTextLine(int index, @Nullable String text);
@NotNull TextLine insertTextLine(int index, @Nullable String text);
/**
@ -69,8 +66,7 @@ public interface Hologram {
* @throws IndexOutOfBoundsException if the index is out of range (index < 0 || index >= size())
* @since 1
*/
@NotNull
ItemLine insertItemLine(int index, @NotNull ItemStack itemStack);
@NotNull ItemLine insertItemLine(int index, @NotNull ItemStack itemStack);
/**
@ -81,8 +77,7 @@ public interface Hologram {
* @throws IndexOutOfBoundsException if the index is out of range (index < 0 || index >= size())
* @since 1
*/
@NotNull
HologramLine getLine(int index);
@NotNull HologramLine getLine(int index);
/**
* Removes a line at a given index. Since: v2.0.1
@ -147,8 +142,7 @@ public interface Hologram {
* @return the Location of the hologram
* @since 1
*/
@NotNull
Location getLocation();
@NotNull Location getLocation();
/**
* Returns the X coordinate.
@ -183,8 +177,7 @@ public interface Hologram {
* @return the world of the hologram
* @since 1
*/
@NotNull
World getWorld();
@NotNull World getWorld();
/**
@ -195,8 +188,7 @@ public interface Hologram {
* @return the VisibilityManager of this hologram
* @since 1
*/
@NotNull
VisibilityManager getVisibilityManager();
@NotNull VisibilityManager getVisibilityManager();
/**

View File

@ -39,9 +39,8 @@ public interface HolographicDisplaysAPI {
static int getVersion() {
return 1;
}
@NotNull
static HolographicDisplaysAPI get(@NotNull Plugin plugin) {
static @NotNull HolographicDisplaysAPI get(@NotNull Plugin plugin) {
return HolographicDisplaysAPIProvider.getImplementation().getHolographicDisplaysAPI(plugin);
}
@ -52,8 +51,7 @@ public interface HolographicDisplaysAPI {
* @return the created hologram
* @since 1
*/
@NotNull
Hologram createHologram(@NotNull Location source);
@NotNull Hologram createHologram(@NotNull Location source);
/**
* Returns all the active holograms. A hologram is no longer active after {@link Hologram#delete()} is invoked.
@ -61,8 +59,7 @@ public interface HolographicDisplaysAPI {
* @return an immutable collection of active holograms
* @since 1
*/
@NotNull
Collection<Hologram> getHolograms();
@NotNull Collection<Hologram> getHolograms();
/**
* @since 1
@ -75,8 +72,7 @@ public interface HolographicDisplaysAPI {
* @return a collection of placeholder identifiers
* @since 1
*/
@NotNull
Collection<String> getRegisteredPlaceholders();
@NotNull Collection<String> getRegisteredPlaceholders();
/**
* Unregisters a placeholder.

View File

@ -29,7 +29,6 @@ public interface CollectableLine extends HologramLine {
* @return the current PickupHandler, can be null.
* @since 1
*/
@Nullable
PickupHandler getPickupHandler();
@Nullable PickupHandler getPickupHandler();
}

View File

@ -21,8 +21,7 @@ public interface HologramLine {
* @return the parent Hologram.
* @since 1
*/
@NotNull
Hologram getParent();
@NotNull Hologram getParent();
/**
* Removes this line from the parent Hologram. Since: v2.0.1

View File

@ -19,8 +19,7 @@ public interface ItemLine extends CollectableLine, TouchableLine {
* @return the ItemStack if this ItemLine.
* @since 1
*/
@NotNull
ItemStack getItemStack();
@NotNull ItemStack getItemStack();
/**
* Sets the ItemStack for this ItemLine.

View File

@ -18,8 +18,7 @@ public interface TextLine extends TouchableLine {
* @return the current text of this line.
* @since 1
*/
@Nullable
String getText();
@Nullable String getText();
/**
* Sets the text of this TextLine.

View File

@ -29,7 +29,6 @@ public interface TouchableLine extends HologramLine {
* @return the current TouchHandler, can be null.
* @since 1
*/
@Nullable
TouchHandler getTouchHandler();
@Nullable TouchHandler getTouchHandler();
}

View File

@ -15,7 +15,6 @@ public interface PlaceholderFactory {
/**
* @since 1
*/
@Nullable
Placeholder getPlaceholder(@Nullable String argument);
@Nullable Placeholder getPlaceholder(@Nullable String argument);
}

View File

@ -25,7 +25,6 @@ public interface PlaceholderReplacer {
* @return the placeholder replacement
* @since 1
*/
@Nullable
String getReplacement(@Nullable String argument);
@Nullable String getReplacement(@Nullable String argument);
}

View File

@ -39,8 +39,7 @@ public class PlaceholdersReplacementTracker {
});
}
@Nullable
public String getOrUpdateReplacement(PlaceholderOccurrence placeholderOccurrence, long currentTick) throws PlaceholderException {
public @Nullable String getOrUpdateReplacement(PlaceholderOccurrence placeholderOccurrence, long currentTick) throws PlaceholderException {
ReplacementHolder replacementHolder = currentReplacements.get(placeholderOccurrence);
if (replacementHolder == null) {

View File

@ -63,8 +63,7 @@ public class PlaceholdersUpdateTask implements Runnable {
}
}
@Nullable
private TrackedLine createTrackedLineIfNeeded(StandardTextLine textLine) {
private @Nullable TrackedLine createTrackedLineIfNeeded(StandardTextLine textLine) {
if (!textLine.isAllowPlaceholders()) {
return null;
}

View File

@ -26,18 +26,15 @@ public class PlaceholderOccurrence {
this.hashCode = Objects.hash(pluginName, identifier, argument);
}
@Nullable
public PluginName getPluginName() {
public @Nullable PluginName getPluginName() {
return pluginName;
}
@NotNull
public PlaceholderIdentifier getIdentifier() {
public @NotNull PlaceholderIdentifier getIdentifier() {
return identifier;
}
@Nullable
public String getArgument() {
public @Nullable String getArgument() {
return argument;
}

View File

@ -61,8 +61,7 @@ public class StringWithPlaceholders {
return output.toString();
}
@Nullable
private List<PlaceholderMatch> findPlaceholders(String input) {
private @Nullable List<PlaceholderMatch> findPlaceholders(String input) {
int currentIndex = 0;
int placeholderStartIndex = -1;
List<PlaceholderMatch> matches = null;

View File

@ -61,9 +61,8 @@ public class PlaceholderRegistry {
changeListener.run();
}
@Nullable
public PlaceholderExpansion findBestMatch(PlaceholderOccurrence textOccurrence) {
public @Nullable PlaceholderExpansion findBestMatch(PlaceholderOccurrence textOccurrence) {
PluginName pluginName = textOccurrence.getPluginName();
PlaceholderIdentifier identifier = textOccurrence.getIdentifier();