Skip to content

Commit

Permalink
Remove @Contract from some methods
Browse files Browse the repository at this point in the history
  • Loading branch information
srnyx committed Apr 24, 2023
1 parent 6d008c4 commit 81bc6fc
Show file tree
Hide file tree
Showing 10 changed files with 9 additions and 31 deletions.
@@ -1,6 +1,5 @@
package xyz.srnyx.annoyingapi;

import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;

import java.util.HashMap;
Expand All @@ -23,7 +22,6 @@ public class AnnoyingCooldown {
* @param uuid the UUID of the thing that is being cooled down
* @param type the {@link CooldownType} to use
*/
@Contract(pure = true)
public AnnoyingCooldown(@NotNull AnnoyingPlugin plugin, @NotNull UUID uuid, @NotNull CooldownType type) {
this.plugin = plugin;
this.uuid = uuid;
Expand Down Expand Up @@ -87,7 +85,7 @@ public boolean isOnCooldown() {
*/
public interface CooldownType {
/**
* Returns the cooldown's duration in milliseconds
* Returns the cooldowns duration in milliseconds
*
* @return the duration of the cooldown in milliseconds
*/
Expand Down
8 changes: 2 additions & 6 deletions api/src/main/java/xyz/srnyx/annoyingapi/AnnoyingMessage.java
Expand Up @@ -9,7 +9,6 @@
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;

import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

Expand Down Expand Up @@ -392,7 +391,6 @@ public enum DefaultReplaceType implements ReplaceType {
* @param defaultInput the default input value
* @param outputOperator the {@link BinaryOperator<String>} to use on the input and value
*/
@Contract(pure = true)
DefaultReplaceType(@NotNull String defaultInput, @NotNull BinaryOperator<String> outputOperator) {
this.defaultInput = defaultInput;
this.outputOperator = outputOperator;
Expand All @@ -404,7 +402,7 @@ public enum DefaultReplaceType implements ReplaceType {
*
* @return the default input
*/
@Override @NotNull @Contract(pure = true)
@Override @NotNull
public String getDefaultInput() {
return defaultInput;
}
Expand All @@ -414,7 +412,7 @@ public String getDefaultInput() {
*
* @return the {@link BinaryOperator} to use on the input and value
*/
@Override @NotNull @Contract(pure = true)
@Override @NotNull
public BinaryOperator<String> getOutputOperator() {
return outputOperator;
}
Expand All @@ -435,7 +433,6 @@ private class Replacement {
* @param value the value to replace the text with
* @param type the {@link ReplaceType} to use on the value, if {@code null}, the {@code value} will be used as-is
*/
@Contract(pure = true)
public Replacement(@NotNull String before, @Nullable Object value, @Nullable ReplaceType type) {
this.before = before;
this.value = String.valueOf(value);
Expand Down Expand Up @@ -502,7 +499,6 @@ public enum BroadcastType {
*
* @return true if the broadcast type is a title
*/
@Contract(pure = true)
public boolean isTitle() {
return this == TITLE || this == SUBTITLE || this == FULL_TITLE;
}
Expand Down
Expand Up @@ -4,7 +4,6 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

Expand Down Expand Up @@ -51,7 +50,6 @@ public class AnnoyingSender {
* @param label the {@link Command}'s label that was used
* @param args the {@link Command}'s arguments that were used
*/
@Contract(pure = true)
public AnnoyingSender(@NotNull AnnoyingPlugin plugin, @NotNull CommandSender cmdSender, @Nullable Command cmd, @Nullable String label, @Nullable String[] args) {
this.plugin = plugin;
this.cmdSender = cmdSender;
Expand All @@ -67,7 +65,6 @@ public AnnoyingSender(@NotNull AnnoyingPlugin plugin, @NotNull CommandSender cmd
* @param plugin the {@link AnnoyingPlugin} instance
* @param cmdSender the {@link CommandSender} to be used
*/
@Contract(pure = true)
public AnnoyingSender(@NotNull AnnoyingPlugin plugin, @NotNull CommandSender cmdSender) {
this(plugin, cmdSender, null, null, null);
}
Expand Down
@@ -1,6 +1,5 @@
package xyz.srnyx.annoyingapi.command;

import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;

import xyz.srnyx.annoyingapi.AnnoyingMessage;
Expand All @@ -21,7 +20,6 @@ public class DisabledCommand implements AnnoyingCommand {
*
* @param plugin the {@link AnnoyingPlugin} instance
*/
@Contract(pure = true)
public DisabledCommand(@NotNull AnnoyingPlugin plugin) {
this.plugin = plugin;
}
Expand Down
Expand Up @@ -2,7 +2,6 @@

import org.bukkit.Bukkit;

import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;

import java.io.File;
Expand Down Expand Up @@ -42,7 +41,6 @@ public class AnnoyingDependency {
* @param required whether the dependency is required to be installed
* @param enableAfterDownload whether to attempt to enable the dependency after it has been downloaded
*/
@Contract(pure = true)
public AnnoyingDependency(@NotNull String name, @NotNull Map<AnnoyingDownload.Platform, String> platforms, boolean required, boolean enableAfterDownload) {
this.name = name;
this.platforms = platforms;
Expand Down
Expand Up @@ -6,7 +6,6 @@
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageByEntityEvent;

import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;

import xyz.srnyx.annoyingapi.AnnoyingListener;
Expand All @@ -28,7 +27,6 @@ public class EventHandlers implements AnnoyingListener {
*
* @param plugin the plugin instance
*/
@Contract(pure = true)
public EventHandlers(@NotNull AnnoyingPlugin plugin) {
this.plugin = plugin;
}
Expand Down
Expand Up @@ -5,7 +5,6 @@
import org.bukkit.event.HandlerList;
import org.bukkit.event.entity.EntityDamageByEntityEvent;

import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;


Expand All @@ -27,6 +26,7 @@ public class PlayerDamageByPlayerEvent extends EntityDamageByEntityEvent {
* @param damage the amount of damage dealt
*/
public PlayerDamageByPlayerEvent(@NotNull Player damager, @NotNull Player damagee, @NotNull DamageCause cause, double damage) {
//noinspection deprecation
super(damager, damagee, cause, damage);
}

Expand All @@ -35,7 +35,7 @@ public PlayerDamageByPlayerEvent(@NotNull Player damager, @NotNull Player damage
*
* @return {@link #HANDLERS}
*/
@NotNull @Contract(pure = true)
@NotNull
public static HandlerList getHandlerList() {
return HANDLERS;
}
Expand All @@ -47,7 +47,7 @@ public static HandlerList getHandlerList() {
*/
@Override @NotNull
public HandlerList getHandlers() {
return HANDLERS;
return getHandlerList();
}

/**
Expand Down
@@ -1,9 +1,8 @@
package xyz.srnyx.annoyingexample;

import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;

import org.jetbrains.annotations.Nullable;

import xyz.srnyx.annoyingapi.command.AnnoyingCommand;
import xyz.srnyx.annoyingapi.AnnoyingCooldown;
import xyz.srnyx.annoyingapi.AnnoyingMessage;
Expand All @@ -28,7 +27,6 @@ public class ExampleCommand implements AnnoyingCommand {
*
* @param plugin the {@link ExamplePlugin} instance
*/
@Contract(pure = true)
public ExampleCommand(@NotNull ExamplePlugin plugin) {
this.plugin = plugin;
}
Expand Down
@@ -1,7 +1,5 @@
package xyz.srnyx.annoyingexample;

import org.jetbrains.annotations.Contract;

import xyz.srnyx.annoyingapi.AnnoyingCooldown;


Expand All @@ -24,12 +22,11 @@ public enum ExampleCooldown implements AnnoyingCooldown.CooldownType {
*
* @param duration cooldown duration in milliseconds
*/
@Contract(pure = true)
ExampleCooldown(long duration) {
ExampleCooldown(@SuppressWarnings("SameParameterValue") long duration) {
this.duration = duration;
}

@Override @Contract(pure = true)
@Override
public long getDuration() {
return duration;
}
Expand Down
Expand Up @@ -3,7 +3,6 @@
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;

import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;

import xyz.srnyx.annoyingapi.AnnoyingListener;
Expand All @@ -25,7 +24,6 @@ public class ExampleListener implements AnnoyingListener {
*
* @param plugin the {@link ExamplePlugin} instance
*/
@Contract(pure = true)
public ExampleListener(@NotNull ExamplePlugin plugin) {
this.plugin = plugin;
}
Expand Down

0 comments on commit 81bc6fc

Please sign in to comment.