Skip to content

Commit

Permalink
TagManager#setTag requires NotNull
Browse files Browse the repository at this point in the history
  • Loading branch information
Oribuin committed Nov 29, 2022
1 parent 4a01491 commit 76bef69
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/main/java/xyz/oribuin/eternaltags/gui/FavouritesGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,10 @@ private void addTags(@NotNull BaseGui gui, @NotNull Player player) {
private void setTag(Player player, Tag tag) {

var activeTag = this.manager.getUserTag(player);
if (activeTag == null)
return;

if (activeTag != null && activeTag.equals(tag) && Setting.RE_EQUIP_CLEAR.getBoolean()) {
if (activeTag.equals(tag) && Setting.RE_EQUIP_CLEAR.getBoolean()) {
this.clearTag(player);
return;
}
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/xyz/oribuin/eternaltags/gui/TagsGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,10 @@ private void addTags(@NotNull BaseGui gui, @NotNull Player player, @Nullable Str
private void setTag(Player player, Tag tag) {

var activeTag = this.manager.getUserTag(player);
if (activeTag == null)
return;

if (activeTag != null && activeTag.equals(tag) && Setting.RE_EQUIP_CLEAR.getBoolean()) {
if (activeTag.equals(tag) && Setting.RE_EQUIP_CLEAR.getBoolean()) {
this.clearTag(player);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,7 @@ public Tag getTagFromUUID(UUID uuid) {
* @return The active tag if present
* @since 1.1.6
*/
@Nullable
public Tag getUserTag(UUID uuid) {
public @Nullable Tag getUserTag(UUID uuid) {
final var dataManager = this.rosePlugin.getManager(DataManager.class);
var tag = dataManager.getCachedUsers().get(uuid);
if (tag == null)
Expand Down Expand Up @@ -305,7 +304,7 @@ public Tag getUserTag(UUID uuid) {
* @return The active tag if present
* @
*/
public Tag getUserTag(Player player) {
public @Nullable Tag getUserTag(Player player) {
return this.getUserTag(player.getUniqueId());
}

Expand All @@ -317,7 +316,7 @@ public Tag getUserTag(Player player) {
* @return The active tag if present
* @since 1.1.6
*/
public Tag getUserTag(OfflinePlayer player) {
public @Nullable Tag getUserTag(OfflinePlayer player) {
return this.getUserTag(player.getUniqueId());
}

Expand All @@ -340,7 +339,7 @@ public Tag getPlayersTag(@NotNull OfflinePlayer offlinePlayer) {
* @param uuid The UUID of the player.
* @param tag The tag of the user.
*/
public void setTag(UUID uuid, Tag tag) {
public void setTag(@NotNull UUID uuid, @NotNull Tag tag) {
this.rosePlugin.getManager(DataManager.class).saveUser(uuid, tag);
}

Expand Down

0 comments on commit 76bef69

Please sign in to comment.