Skip to content

Allow relational placeholders #8

@markhughes

Description

@markhughes

Hello! Thanks for the awesome work with LegendChat

Currently LegacyFactions adds our placeholders through this method:

@EventHandler
public void onChatEvent(ChatMessageEvent event) {
	for (FactionsPlaceholder placeholder : FactionsPlaceholders.get().getPlaceholders()) {
		if (!event.getTags().contains("factions_" + placeholder.placeholder())) continue;
			
		event.setTagValue("factions_" + placeholder.placeholder(), placeholder.get(event.getSender()));
	}
}

Which works great for regular messages! However, we would like to add relational placeholders.

From the looks of it you take over chat (cancel and send it yourself) - which is great! Because this means you can set the format per-player.

Basically the relational placeholders are placeholders based on the relationship between two players. So an event that executes with the sender, and the receiver could help out here.

E.g. with LegacyFactions this would allow us to determine if they are an enemy/ally/truce/neutral. So rel_factions_relation_colour would return a colour to reflect this. So RED for enemies.

If we could maybe add a ChatMessageSendingEvent that allows us to change the format for a single player so we can add in our relationship based placeholders that would be awesome! I would create a PR, I just don't have time to go through the codebase and learn the project! :(

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions