From db97316dee2df626a7c55d8d05c4282d7c5d625b Mon Sep 17 00:00:00 2001 From: kevinbarnes Date: Sun, 12 Sep 2021 23:12:18 -0400 Subject: [PATCH] v2.0.5 - one more fix - fix /reload applying tab nicks if the setting was changed --- .../java/dev/majek/hexnicks/storage/JsonStorage.java | 5 ----- .../java/dev/majek/hexnicks/storage/SqlStorage.java | 7 ------- .../java/dev/majek/hexnicks/storage/StorageMethod.java | 10 ++++++++-- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/main/java/dev/majek/hexnicks/storage/JsonStorage.java b/src/main/java/dev/majek/hexnicks/storage/JsonStorage.java index 906286b..0895356 100644 --- a/src/main/java/dev/majek/hexnicks/storage/JsonStorage.java +++ b/src/main/java/dev/majek/hexnicks/storage/JsonStorage.java @@ -78,9 +78,4 @@ public void saveNick(@NotNull Player player) { } }); } - - @Override - public void updateNicks() { - // Nothing needed for json storage - } } \ No newline at end of file diff --git a/src/main/java/dev/majek/hexnicks/storage/SqlStorage.java b/src/main/java/dev/majek/hexnicks/storage/SqlStorage.java index a56a366..d1d0db8 100644 --- a/src/main/java/dev/majek/hexnicks/storage/SqlStorage.java +++ b/src/main/java/dev/majek/hexnicks/storage/SqlStorage.java @@ -103,11 +103,4 @@ public void saveNick(@NotNull Player player) { ex.printStackTrace(); } } - - @Override - public void updateNicks() { - for (Player player : Bukkit.getOnlinePlayers()) { - Nicks.software().setNick(player, getNick(player.getUniqueId())); - } - } } \ No newline at end of file diff --git a/src/main/java/dev/majek/hexnicks/storage/StorageMethod.java b/src/main/java/dev/majek/hexnicks/storage/StorageMethod.java index 6f9b516..b852983 100644 --- a/src/main/java/dev/majek/hexnicks/storage/StorageMethod.java +++ b/src/main/java/dev/majek/hexnicks/storage/StorageMethod.java @@ -25,7 +25,10 @@ package dev.majek.hexnicks.storage; import java.util.UUID; + +import dev.majek.hexnicks.Nicks; import net.kyori.adventure.text.Component; +import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; @@ -67,6 +70,9 @@ public interface StorageMethod { /** * Update the nickname of all online players from storage. */ - void updateNicks(); - + default void updateNicks() { + for (Player player : Bukkit.getOnlinePlayers()) { + Nicks.software().setNick(player, getNick(player.getUniqueId())); + } + } } \ No newline at end of file