Added support for psuedo-papi syntax without placeholderapi for internal placeholders

This commit is contained in:
BuildTools 2020-11-13 15:24:03 +00:00
parent efb0ad84e0
commit 0915d4c31a

View File

@ -32,8 +32,16 @@ public class PlaceholderManager {
}
public static String translatePlaceholders(String text, Player player) {
AtomicReference<String> translatedReference = new AtomicReference<>(text);
integrations.forEach(placeholderIntegration -> translatedReference.set(placeholderIntegration.translate(translatedReference.get(), player)));
return translatedReference.get();
if(integrations.isEmpty()) {
placeholders.forEach(placeholderEntry -> {
String test = "%ecoenchants_" + placeholderEntry.getIdentifier() + "%";
text.replaceAll(test, placeholderEntry.getResult(player));
});
return text;
} else {
AtomicReference<String> translatedReference = new AtomicReference<>(text);
integrations.forEach(placeholderIntegration -> translatedReference.set(placeholderIntegration.translate(translatedReference.get(), player)));
return translatedReference.get();
}
}
}