Skip to content

Commit

Permalink
Merge pull request #149 from Nookure/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Angelillo15 authored Dec 31, 2024
2 parents 633bc92 + 723d0ea commit 408baec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ public void checkVersion() {
if (jenkinsJob.lastCompletedBuild().number() > Constants.JENKINS_BUILD_NUMBER) {
getLogger().warning("There is a new version available! You are %n versions behind.".replace("%n", String.valueOf(jenkinsJob.lastCompletedBuild().number() - Constants.JENKINS_BUILD_NUMBER)));
getLogger().warning("You can download it from here: " + jenkinsJob.lastCompletedBuild().url());
getLogger().warning("Or you can download it from here: https://modrinth.com/plugin/staff");
}
}).exceptionally(throwable -> {
getLogger().warning("Couldn't get the latest version from Jenkins.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@

@Singleton
public final class TabNameTagTransformer implements NameTagTransformer {
private final NameTagManager nameTagManager = TabAPI.getInstance().getNameTagManager();

@Inject
public TabNameTagTransformer(@NotNull final Logger logger) {
if (nameTagManager == null) {
if (getNameTagManager() == null) {
logger.severe("TabAPI is not loaded, disabling TabNametagTransformer.");
}
}
Expand All @@ -27,6 +25,7 @@ public TabNameTagTransformer(@NotNull final Logger logger) {
public void setPrefix(@NotNull PlayerWrapper player, @NotNull String prefix) {
requireNonNull(player, "Player cannot be null.");
requireNonNull(prefix, "Prefix cannot be null.");
final var nameTagManager = getNameTagManager();

if (nameTagManager == null) return;
nameTagManager.setPrefix(getTabPlayer(player), prefix);
Expand All @@ -35,6 +34,7 @@ public void setPrefix(@NotNull PlayerWrapper player, @NotNull String prefix) {
@Override
public void removePrefix(@NotNull PlayerWrapper player) {
requireNonNull(player, "Player cannot be null.");
final var nameTagManager = getNameTagManager();

if (nameTagManager == null) return;
nameTagManager.setPrefix(getTabPlayer(player), null);
Expand All @@ -43,6 +43,7 @@ public void removePrefix(@NotNull PlayerWrapper player) {
@Override
public void setSuffix(@NotNull PlayerWrapper player, @NotNull String suffix) {
requireNonNull(player, "Player cannot be null.");
final var nameTagManager = getNameTagManager();

if (nameTagManager == null) return;
nameTagManager.setSuffix(getTabPlayer(player), suffix);
Expand All @@ -51,6 +52,7 @@ public void setSuffix(@NotNull PlayerWrapper player, @NotNull String suffix) {
@Override
public void removeSuffix(@NotNull PlayerWrapper player) {
requireNonNull(player, "Player cannot be null.");
final var nameTagManager = getNameTagManager();

if (nameTagManager == null) return;
nameTagManager.setSuffix(getTabPlayer(player), null);
Expand All @@ -59,4 +61,8 @@ public void removeSuffix(@NotNull PlayerWrapper player) {
private TabPlayer getTabPlayer(PlayerWrapper player) {
return TabAPI.getInstance().getPlayer(player.getUniqueId());
}

private NameTagManager getNameTagManager() {
return TabAPI.getInstance().getNameTagManager();
}
}

0 comments on commit 408baec

Please sign in to comment.