Class FlagMessageBuilder
java.lang.Object
de.z0rdak.yawp.util.text.messages.FlagMessageBuilder
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic net.minecraft.network.chat.MutableComponentbuildFrom(FlagCheckResult result, @Nullable Map<String, String> substitutes) Builds a flag message from the given flag check result and substitutes.defaultSubstitutesFor(FlagCheckResult result) Returns a map with default substitutes for the given flag check result.
-
Field Details
-
FLAG_TEMPLATE
- See Also:
-
POS_TEMPLATE
- See Also:
-
REGION_TEMPLATE
- See Also:
-
DIM_TEMPLATE
- See Also:
-
PLAYER_TEMPLATE
- See Also:
-
GROUP_TEMPLATE
- See Also:
-
ENTITY_TEMPLATE
- See Also:
-
BLOCK_ENTITY
- See Also:
-
TEAM_TEMPLATE
- See Also:
-
-
Constructor Details
-
FlagMessageBuilder
public FlagMessageBuilder()
-
-
Method Details
-
defaultSubstitutesFor
Returns a map with default substitutes for the given flag check result.
The substitutes are built from the flag, responsible region, position and player in the result.
The substitutes are then returned as a map.- Parameters:
result- the flag check result to get the default substitutes for- Returns:
- a map with default substitutes for the given flag check result
-
buildFrom
public static net.minecraft.network.chat.MutableComponent buildFrom(FlagCheckResult result, @Nullable @Nullable Map<String, String> substitutes) Builds a flag message from the given flag check result and substitutes.
The flag message is built from the flag message template of the flag in the result.
The matches in the flag message template are replaced with the substitutes.
The flag message is then returned as aMutableComponent.
Contract: Flag must not be null. Responsible region must not be null.- Parameters:
result- the flag check result to build the message forsubstitutes- the substitutes to replace the matches in the flag message template with- Returns:
- the flag message for the given flag check result and substitutes
-