crwdns120035:0crwdne120035:0

crwdns120037:0crwdne120037:0

crwdns120039:0:javadoc:crwdnd120039:0{PlaceholderParsers}crwdnd120039:0:javadoc:crwdne120039:0

Sponge.getRegistry().getType(PlaceholderParser.class, id);

Tip

crwdns120041:0crwdne120041:0

crwdns120043:0crwdne120043:0

crwdns120045:0:javadoc:crwdnd120045:0:javadoc:crwdnd120045:0:javadoc:crwdnd120045:0:javadoc:crwdne120045:0

crwdns120047:0crwdne120047:0

  • crwdns120049:0:javadoc:crwdnd120049:0:javadoc:crwdne120049:0

  • crwdns120051:0crwdne120051:0

crwdns120053:0:javadoc:crwdne120053:0

crwdns120055:0crwdne120055:0

Player player = ...;

// We know this exists
PlaceholderParser parser = Sponge.getRegistry().getType(PlaceholderParser.class, "sponge:name").get();
PlaceholderContext context = PlaceholderContext.builder()
    .setAssociatedObject(player)
    .build();
Text text = parser.parse(context);

crwdns120057:0crwdne120057:0

crwdns120059:0crwdne120059:0

crwdns120061:0:javadoc:crwdnd120061:0:javadoc:crwdnd120061:0:javadoc:crwdne120061:0

crwdns120063:0:javadoc:crwdne120063:0

crwdns120065:0crwdne120065:0

PlaceholderText placeholderText = PlaceholderText.builder().setContext(context).setParser(parser).build();
Text result = Text.of("Hello! Your name is ", placeholderText, "!");

crwdns120067:0crwdne120067:0

Note

crwdns120069:0:javadoc:crwdnd120069:0:javadoc:crwdne120069:0