mirror of
				https://github.com/PlaceholderAPI/PlaceholderAPI
				synced 2025-11-04 07:22:30 +01:00 
			
		
		
		
	Merge remote-tracking branch 'origin/master'
This commit is contained in:
		@@ -20,7 +20,7 @@
 | 
			
		||||
 | 
			
		||||
package me.clip.placeholderapi.replacer;
 | 
			
		||||
 | 
			
		||||
import me.clip.placeholderapi.PlaceholderHook;
 | 
			
		||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
 | 
			
		||||
import org.bukkit.ChatColor;
 | 
			
		||||
import org.bukkit.OfflinePlayer;
 | 
			
		||||
import org.jetbrains.annotations.NotNull;
 | 
			
		||||
@@ -40,8 +40,9 @@ public final class CharsReplacer implements Replacer
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	@NotNull
 | 
			
		||||
	@Override
 | 
			
		||||
	public @NotNull String apply(@NotNull final String text, @Nullable final OfflinePlayer player, @NotNull final Function<String, @Nullable PlaceholderHook> lookup)
 | 
			
		||||
	public String apply(@NotNull final String text, @Nullable final OfflinePlayer player, @NotNull final Function<String, @Nullable PlaceholderExpansion> lookup)
 | 
			
		||||
	{
 | 
			
		||||
		final char[]        chars   = text.toCharArray();
 | 
			
		||||
		final StringBuilder builder = new StringBuilder(text.length());
 | 
			
		||||
@@ -162,7 +163,7 @@ public final class CharsReplacer implements Replacer
 | 
			
		||||
				continue;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			final PlaceholderHook placeholder = lookup.apply(identifierString);
 | 
			
		||||
			final PlaceholderExpansion placeholder = lookup.apply(identifierString);
 | 
			
		||||
			if (placeholder == null)
 | 
			
		||||
			{
 | 
			
		||||
				builder.append(closure.head).append(identifierString);
 | 
			
		||||
 
 | 
			
		||||
@@ -20,7 +20,7 @@
 | 
			
		||||
 | 
			
		||||
package me.clip.placeholderapi.replacer;
 | 
			
		||||
 | 
			
		||||
import me.clip.placeholderapi.PlaceholderHook;
 | 
			
		||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
 | 
			
		||||
import org.bukkit.ChatColor;
 | 
			
		||||
import org.bukkit.OfflinePlayer;
 | 
			
		||||
import org.jetbrains.annotations.NotNull;
 | 
			
		||||
@@ -42,8 +42,9 @@ public final class RegexReplacer implements Replacer
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	@NotNull
 | 
			
		||||
	@Override
 | 
			
		||||
	public @NotNull String apply(@NotNull final String text, @Nullable final OfflinePlayer player, @NotNull final Function<String, @Nullable PlaceholderHook> lookup)
 | 
			
		||||
	public String apply(@NotNull final String text, @Nullable final OfflinePlayer player, @NotNull final Function<String, @Nullable PlaceholderExpansion> lookup)
 | 
			
		||||
	{
 | 
			
		||||
		final Matcher matcher = pattern.matcher(text);
 | 
			
		||||
		if (!matcher.find())
 | 
			
		||||
@@ -58,13 +59,13 @@ public final class RegexReplacer implements Replacer
 | 
			
		||||
			final String identifier = matcher.group("identifier");
 | 
			
		||||
			final String parameters = matcher.group("parameters");
 | 
			
		||||
 | 
			
		||||
			final PlaceholderHook hook = lookup.apply(identifier);
 | 
			
		||||
			if (hook == null)
 | 
			
		||||
			final PlaceholderExpansion expansion = lookup.apply(identifier);
 | 
			
		||||
			if (expansion == null)
 | 
			
		||||
			{
 | 
			
		||||
				continue;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			final String requested = hook.onRequest(player, parameters);
 | 
			
		||||
			final String requested = expansion.onRequest(player, parameters);
 | 
			
		||||
			matcher.appendReplacement(builder, requested != null ? requested : matcher.group(0));
 | 
			
		||||
		}
 | 
			
		||||
		while (matcher.find());
 | 
			
		||||
 
 | 
			
		||||
@@ -20,7 +20,7 @@
 | 
			
		||||
 | 
			
		||||
package me.clip.placeholderapi.replacer;
 | 
			
		||||
 | 
			
		||||
import me.clip.placeholderapi.PlaceholderHook;
 | 
			
		||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
 | 
			
		||||
import org.bukkit.OfflinePlayer;
 | 
			
		||||
import org.jetbrains.annotations.NotNull;
 | 
			
		||||
import org.jetbrains.annotations.Nullable;
 | 
			
		||||
@@ -31,7 +31,7 @@ public interface Replacer
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
	@NotNull
 | 
			
		||||
	String apply(@NotNull final String text, @Nullable final OfflinePlayer player, @NotNull final Function<String, @Nullable PlaceholderHook> lookup);
 | 
			
		||||
	String apply(@NotNull final String text, @Nullable final OfflinePlayer player, @NotNull final Function<String, @Nullable PlaceholderExpansion> lookup);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	enum Closure
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user