13
0
geforkt von Mirrors/Velocity

Removed redundant (non-)nullable annotations from boss bar.

Dieser Commit ist enthalten in:
Andrew Steinborn 2019-06-02 17:57:31 -04:00
Ursprung 0a53343547
Commit 8d61e7ffd0
2 geänderte Dateien mit 16 neuen und 22 gelöschten Zeilen

Datei anzeigen

@ -3,7 +3,6 @@ package com.velocitypowered.api.util.bossbar;
import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.Player;
import java.util.Collection; import java.util.Collection;
import net.kyori.text.Component; import net.kyori.text.Component;
import org.checkerframework.checker.nullness.qual.NonNull;
/** /**
* Represents a boss bar, which can be send to a (group of) player(s). * Represents a boss bar, which can be send to a (group of) player(s).
@ -25,7 +24,7 @@ public interface BossBar {
* *
* @param player the player you wish to add * @param player the player you wish to add
*/ */
void addPlayer(@NonNull Player player); void addPlayer(Player player);
/** /**
* Removes player from this boss bar. This removes the player from {@link #getPlayers()} and makes * Removes player from this boss bar. This removes the player from {@link #getPlayers()} and makes
@ -33,7 +32,7 @@ public interface BossBar {
* *
* @param player the player you wish to remove * @param player the player you wish to remove
*/ */
void removePlayer(@NonNull Player player); void removePlayer(Player player);
/** /**
* Removes all specified players from this boss bar. * Removes all specified players from this boss bar.
@ -55,7 +54,6 @@ public interface BossBar {
* *
* @return title * @return title
*/ */
@NonNull
Component getTitle(); Component getTitle();
/** /**
@ -63,7 +61,7 @@ public interface BossBar {
* *
* @param title new title * @param title new title
*/ */
void setTitle(@NonNull Component title); void setTitle(Component title);
/** /**
* Gets the boss bar's percent. * Gets the boss bar's percent.
@ -93,7 +91,6 @@ public interface BossBar {
* *
* @return boss bar color * @return boss bar color
*/ */
@NonNull
BossBarColor getColor(); BossBarColor getColor();
/** /**
@ -101,14 +98,13 @@ public interface BossBar {
* *
* @param color the color you wish the boss bar be displayed with * @param color the color you wish the boss bar be displayed with
*/ */
void setColor(@NonNull BossBarColor color); void setColor(BossBarColor color);
/** /**
* Gets the overlay of the boss bar. * Gets the overlay of the boss bar.
* *
* @return boss bar overlay * @return boss bar overlay
*/ */
@NonNull
BossBarOverlay getOverlay(); BossBarOverlay getOverlay();
/** /**
@ -116,7 +112,7 @@ public interface BossBar {
* *
* @param overlay the overlay you wish the boss bar be displayed with * @param overlay the overlay you wish the boss bar be displayed with
*/ */
void setOverlay(@NonNull BossBarOverlay overlay); void setOverlay(BossBarOverlay overlay);
/** /**
* Returns whenever this boss bar is visible to all added {@link #getPlayers()}. By default, it * Returns whenever this boss bar is visible to all added {@link #getPlayers()}. By default, it

Datei anzeigen

@ -20,8 +20,6 @@ import java.util.Set;
import java.util.UUID; import java.util.UUID;
import net.kyori.text.Component; import net.kyori.text.Component;
import net.kyori.text.serializer.gson.GsonComponentSerializer; import net.kyori.text.serializer.gson.GsonComponentSerializer;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
public class VelocityBossBar implements com.velocitypowered.api.util.bossbar.BossBar { public class VelocityBossBar implements com.velocitypowered.api.util.bossbar.BossBar {
@ -55,7 +53,7 @@ public class VelocityBossBar implements com.velocitypowered.api.util.bossbar.Bos
} }
@Override @Override
public void addPlayers(@NonNull Iterable<Player> players) { public void addPlayers(Iterable<Player> players) {
checkNotNull(players, "players"); checkNotNull(players, "players");
for (Player player : players) { for (Player player : players) {
addPlayer(player); addPlayer(player);
@ -63,7 +61,7 @@ public class VelocityBossBar implements com.velocitypowered.api.util.bossbar.Bos
} }
@Override @Override
public void addPlayer(@NonNull Player player) { public void addPlayer(Player player) {
checkNotNull(player, "player"); checkNotNull(player, "player");
if (!players.contains(player)) { if (!players.contains(player)) {
players.add(player); players.add(player);
@ -74,7 +72,7 @@ public class VelocityBossBar implements com.velocitypowered.api.util.bossbar.Bos
} }
@Override @Override
public void removePlayer(@NonNull Player player) { public void removePlayer(Player player) {
checkNotNull(player, "player"); checkNotNull(player, "player");
players.remove(player); players.remove(player);
if (player.isActive()) { if (player.isActive()) {
@ -83,7 +81,7 @@ public class VelocityBossBar implements com.velocitypowered.api.util.bossbar.Bos
} }
@Override @Override
public void removePlayers(@NonNull Iterable<Player> players) { public void removePlayers(Iterable<Player> players) {
checkNotNull(players, "players"); checkNotNull(players, "players");
for (Player player : players) { for (Player player : players) {
removePlayer(player); removePlayer(player);
@ -96,12 +94,12 @@ public class VelocityBossBar implements com.velocitypowered.api.util.bossbar.Bos
} }
@Override @Override
public @NonNull Component getTitle() { public Component getTitle() {
return title; return title;
} }
@Override @Override
public void setTitle(@NonNull Component title) { public void setTitle(Component title) {
this.title = checkNotNull(title, "title"); this.title = checkNotNull(title, "title");
if (visible) { if (visible) {
BossBar bar = new BossBar(); BossBar bar = new BossBar();
@ -137,17 +135,17 @@ public class VelocityBossBar implements com.velocitypowered.api.util.bossbar.Bos
} }
@Override @Override
public @Nullable Collection<Player> getPlayers() { public Collection<Player> getPlayers() {
return ImmutableList.copyOf(players); return ImmutableList.copyOf(players);
} }
@Override @Override
public @NonNull BossBarColor getColor() { public BossBarColor getColor() {
return color; return color;
} }
@Override @Override
public void setColor(@NonNull BossBarColor color) { public void setColor(BossBarColor color) {
this.color = checkNotNull(color, "color"); this.color = checkNotNull(color, "color");
if (visible) { if (visible) {
sendDivisions(color, overlay); sendDivisions(color, overlay);
@ -155,12 +153,12 @@ public class VelocityBossBar implements com.velocitypowered.api.util.bossbar.Bos
} }
@Override @Override
public @NonNull BossBarOverlay getOverlay() { public BossBarOverlay getOverlay() {
return overlay; return overlay;
} }
@Override @Override
public void setOverlay(@NonNull BossBarOverlay overlay) { public void setOverlay(BossBarOverlay overlay) {
this.overlay = checkNotNull(overlay, "overlay"); this.overlay = checkNotNull(overlay, "overlay");
if (visible) { if (visible) {
sendDivisions(color, overlay); sendDivisions(color, overlay);