Skip to content

Commit

Permalink
Formatting tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
APickledWalrus committed Aug 10, 2024
1 parent e975d19 commit fa96363
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.github.apickledwalrus.skriptplaceholders.skript;

import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;

/**
* An event to be used by Skript for passing context regarding relational placeholders during execution.
Expand All @@ -15,7 +16,7 @@ public RelationalPlaceholderEvent(String placeholder, Player player, Player othe
}

@Override
public Player getPlayer() {
public @NotNull Player getPlayer() {
//noinspection ConstantConditions - player is passed up as NotNull
return super.getPlayer().getPlayer();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,12 @@ private static String[] parsePlaceholders(String[] placeholders, @Nullable Offli
List<String> values = new ArrayList<>();
for (OfflinePlayer player : players) {
for (String placeholder : placeholders) {
// try to find a plugin this placeholder works for
for (PlaceholderPlugin plugin : PlaceholderPlugin.getInstalledPlugins()) {
String value = plugin.parsePlaceholder(placeholder, player);
if (value != null) {
values.add(value);
break;
break; // worked with this plugin, move onto next placeholder
}
}
}
Expand All @@ -99,14 +100,15 @@ private static String[] parsePlaceholders(String[] placeholders, @Nullable Offli
private static String[] parseRelationalPlaceholders(String[] placeholders, Player one, Player two) {
List<String> values = new ArrayList<>();
for (String placeholder : placeholders) {
// try to find a plugin this placeholder works for
for (PlaceholderPlugin plugin : PlaceholderPlugin.getInstalledPlugins()) {
if (!plugin.supportsRelationalPlaceholders()) {
continue;
}
String value = plugin.parseRelationalPlaceholder(placeholder, one, two);
if (value != null) {
values.add(value);
break;
break; // worked with this plugin, move onto next placeholder
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,7 @@ public void unload() {
}

@Override
@Nullable
public String evaluate(String placeholder, @Nullable OfflinePlayer player) {
public @Nullable String evaluate(String placeholder, @Nullable OfflinePlayer player) {
if (isRelational) { // a relational placeholder structure cannot evaluate non-relational placeholders
return null;
}
Expand Down

0 comments on commit fa96363

Please sign in to comment.